SUSE Linux時間服務器及客戶端同步配置
1、時區設置
使用utc仍是local time.
UTC(Universal Time Coordinated)=GMT(Greenwich Mean Time)
Local time 是你手錶上的時間
linux能夠處理UTC時間和蹩腳的Windows所使用的local time
若是機器上同時安裝有Linux和Windows,建議使用local time
若是機器上只安裝有Linux,建議使用utc
肯定後編輯/etc/sysconfig/clock, UTC=0 是local time; UTC=1 是UTC(GMT)java
1)/etc/sysconfig/clock查看當前時區
HWCLOCK="-u" #與下面設置的時區對應
下面2項不用改#jvm/Nginx等程序取的時間才與date命令時間一致
TIMEZONE="America/New_York"
DEFAULT_TIMEZONE="US/Eastern"linux
2)使用tzselect設置時區(========好像對時間同步沒有用)
#/usr/bin/tzselect
逐步選擇就ok服務器
3)複製相應的時區文件,替換系統默認時區 jvm
或者 cp /usr/share/zoneinfo/Asia/Beijing /etc/localtime(====這個不能同步時間,不知緣由)ide
4)java時區:java_opts增長 -Duser.timezone=GMT+8rest
2、時間同步
內網時間服務器:172.22.14.11
1)服務器端配置/etc/ntp.conf
restrict 127.0.0.1
restrict 172.22.12.0 mask 255.255.255.0 #有幾種都配置上
restrict 172.22.13.0 mask 255.255.255.0
restrict 172.22.14.0 mask 255.255.255.0
restrict 172.22.15.0 mask 255.255.255.0server
server 218.75.4.130 #218.75.4.130是時鐘服務器crontab
2)服務器端ntp服務從新啓動 (xntp / ntp) 同步
(suse linux上是/etc/init.d/xntp restart)it
3)客戶端只作定時同步 #crontab -e 40 4 * /usr/sbin/sntp -P no -r 172.22.14.11 #service cron restart