Two ways to modify server time in liunx

零到壹度
Release: 2018-04-09 11:09:56
Original
4859 people have browsed it

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

2.6 Configuring time synchronization

##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>
Copy after login


##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 newly added node machines, you need to configure crontab -e to keep the cluster time consistent. Use web pages to implement modifications Server system time

##Related recommendations:

How to change the server’s system time under Linux

Set the time server

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template