When working on big data, inconsistent cluster time will cause many problems. eg: Abnormal heartbeat, abnormal process communication, etc. It is important to keep the timing consistent between clusters. There are two main ways below
The first way is to modify the time manually.
1. Set the system time to 5:55 minutes and 55 seconds using the command: "date -s 17:55:55"
#date -s “12:12:23 2006-10-10″ //This way you can set the entire time
2. Write the current time and date into the BIOS to avoid invalidation after restarting
Command: "hwclock -w".
#The second method is to use ntpd+crontab to set automatic Synchronization time
##For details, please refer to "Operating System Environment Configuration.doc"
a) Modify the file /etc/ntp.conf
server 127.127.1.0 minpoll 4 maxpoll5
fudge 127.127.1.0 stratum 2
##b) Modify file
<span style="font-size:18px;"><strong>/etc/ntp/step-tickers</strong></span>
##127.0.0.1
c) Start the service
##hwclock --set --date="02/14/2017 11:24:00"
hwclock –s
Check whether the crontab timing service is running through service crond status/stop/start Open
(Each node in the cluster must open crontab)
Each node server Set time synchronization with the master node:
Manual synchronization:
/usr/sbin /ntpdate rtw01
## Scheduled synchronization, synchronize every 3 minutes:
[root @centosX ~]# crontab -e
*/3 * * * * /usr/sbin/ntpdate rtw01 Execute every 3 minutes
##3 * * * * /usr/sbin/ntpdate rtw01 Execute once every 3 minutes, with an interval of 1 hour
For
##Related recommendations: |
How to change the server’s system time under Linux
The above is the detailed content of Two ways to modify server time in liunx. For more information, please follow other related articles on the PHP Chinese website!