Linux host time synchronization Summary (ntpdate)
Time Synchronization is required when the production server is deployed,In particular, the Database Host must synchronize time,Prevent low-level errors!
Summarize my deployment experience:
1. Create a timing synchronization policy in crontab;
05 06, 12, 18, 23 ***/usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w;
2. Add a time synchronization policy to the startup Item.
/Usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w;
Note:-us parameter:-u is synchronized through the firewall of ntpserver, and s is used to write synchronization logs to system logs;
One-click deployment script writing:
# Cat synctime. sh
<Span style = "font-size: 14px;"> #! /Bin/shrpm-Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmyum-y install ntpdatecat <EOF>/var/spool/cron/root # Time Synchronization 05, ***/usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w; EOFecho "/usr/sbin/ntpdate-us ntp.nasa.w.w.hwclock-w; ">/etc/rc. local/bin/sh/usr/sbin/ntpdate-us ntp.nasa.gov ntp.sjtu.edu.cn; hwclock-w; echo "Time Synchronization deployment OK" </span>
<span style="font-size:14px;"></span>