CentOS/Linux automatic server synchronization time
The newly installed CentOS system server may have an incorrect time, which is very important during cluster creation. It is very likely that the cluster will fail due to time, therefore, you need to adjust the time zone and time. As follows, the CentOS system uses NTP to synchronize time from a time server so that the time is synchronized at regular intervals.
NTP: Short for Network Time Protocol, which is a standard Internet Protocol used for Time synchronization on the Internet. NTP is used to synchronize computer time to a certain time standard. The current Time standard is Universal Time Coordinated ).
Perform the following steps to synchronize time in the CentOS system:
1. Download ntpdate
Note: Some versions do not contain ntpdate, so you need to download
# Yum install-y ntpdate
2. Change the time zone to Shanghai, that is, Beijing time + Zone 8.
Note: You can check the/usr/share/zoneinfo directory if you want to change the time zone.
# Cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
# Yes | cp-f/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
3. Use NTP to synchronize time
# Ntpdate us.pool.ntp.org
4. timed synchronization time (clock synchronization every 10 minutes)
# Crontab-l>/tmp/crontab. bak
# Echo "*/10 *****/usr/sbin/ntpdate us.pool.ntp.org | logger-t NTP">/tmp/crontab. bak
# Crontab/tmp/crontab. bak
In this way, the time problem is solved.
CentOS NTP server installation and configuration
NTP servers in Linux
NTP client configurations for multiple operating systems
Build an enterprise-level NTP Time Server
Set up an ntp time synchronization server in Linux
Enable NTP time server in CentOS 6.3