CentOS View the time zone used by the current system, adjust the time zone before setting up the NTPD service, for example, provide the timing service host IP in the cluster 192.168.3.1
[Email protected] conf]$ Date-rmon, June 2015 19:24:39 +0800
If it's not our time zone, set the time zone to the East 8 zone.
Cp/usr/share/zoneinfo/asia/shanghai/etc/localtimemon, June 2015 19:24:39 +0800
Modify the NTPD service configuration file vim/etc/ntp.conf
# for more information about this file, see the man pages# ntp.conf (5),  NTP_ACC (5), ntp_auth (5), ntp_clock (5), ntp_misc (5), ntp_mon (5). Driftfile /var/lib/ntp/drift# permit time synchronization with our time source, but do not# permit the source to query or Modify the service on this system. #restrict default kod nomodify Notrap nopeer noquery#restrict -6 default kod nomodify notrap nopeer noquery# Permit all access over the loopback interface. this could# be tightened as well, but to do so would effect some of# the administrative functions.restrict 127.0.0.1 #restrict -6 ::1# hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notraprestrict 192.168.3.0 mask 255.255.255.0 nomodifyrestrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust# Use public servers from the pool.ntp.org project.# Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0. centos.pool.ntp.org iburstserver 1.centos.pool.ntp.org iburstserver 2.centos.pool.ntp.org iburstserver 3.centos.pool.ntp.org iburstserver 127.127.1.0#broadcast 192.168.1.255 autokey# broadcast server#broadcastclient# broadcast client#broadcast 224.0.1.1 autokey# multicast server#multicastclient 224.0.1.1# multicast client# Manycastserver 239.255.254.254# manycast serVer#manycastclient 239.255.254.254 autokey # manycast client# enable public key cryptography. #cryptoincludefile /etc/ntp/crypto/pw# key file containing the keys and key identifiers used when operating# with symmetric key cryptography. keys /etc/ntp/keys# specify the key identifiers which are trusted. #trustedkey 4 8 42# specify the key identifier to use with the ntpdc utility. #requestkey 8# specify the key identifier to use with the ntpq utility. #controlkey 8# enable writing of statistics records. #statistics clockstats Cryptostats loopstats peerstats
Restart the service NTPD start services as the host that provides the time service in the cluster, first use network time to update the timing host 192.168.3.1
Ntpdate 0.cn.pool.ntp.org/sbin/hwclock-w
Then set up the Crontab service on the other hosts on the cluster and update your own time synchronously
CRONTAB-E10 * * * (/usr/sbin/ntpdate 192.168.3.1 &&/sbin/hwclock-w) >>/var/log/ntpdate.log# daily 16:10 Time on the host of the step timing
This article from the "Down-to-earth, look at the Stars" blog, please be sure to keep this source http://xubcing.blog.51cto.com/3502962/1659727
Linux Set time synchronization command