当前位置:网站首页>Deployment (10): intranet cluster NTP clock synchronization

Deployment (10): intranet cluster NTP clock synchronization

2022-06-08 23:40:00 Lxinccode

Reference resources :

        https://wenku.baidu.com/view/8a649980f624ccbff121dd36a32d7375a417c6f2.html

        https://blog.csdn.net/zhong_jianyu/article/details/86220914# Single feasible

        CentOS7 Time synchronization NTP Service installation and configuration _Huber~ The blog of -CSDN Blog _centos To configure ntp Time synchronization

         inappropriate address 172.18.74.119 for the fudge_weixin_33786077 The blog of -CSDN Blog

1. Download dependency package

Use of public network machines yum Download all dependent packages

#  install yum-utils
yum -y install yum-utils
 
#  download  ntp  Total dependent package 
repotrack ntp

2. install ntp

Upload all downloaded in the previous step rpm Package all the machines in the intranet , Execution and installation

rpm -Uvh --force --nodeps *.rpm

3. To configure

3.1.ntp The server

Choose a machine as the clock source ( If the machine ip by 192.168.1.1), The machine is modified [/etc/ntp.conf] file

Delete restrict and server Start configuration , Add the following configuration

restrict default nomodify
server 127.127.1.0
Fudge 127.127.1.0 stratum 10

3.2.ntp client

modify [/etc/ntp.conf] file

Delete server Start configuration , Add the following configuration (ip by ntp The server ip)

server 192.168.1.1

4. start-up ntp service

All machines perform

#  start-up 
service ntpd start
#  Check the status 
service ntpd status
#  Set power on self start 
chkconfig ntpd on
#  see ntp Clock source 
ntpq -p
#  see ntp state ( The manual synchronization becomes normal after a period of time )
ntpstat

Client execution synchronization time

ntpdate -u 192.168.1.1

5. The client sets the timing synchronization time

adopt crontab Timing task timing synchronization time

Edit scheduled tasks

crontab -e

Add tasks ( Every time 10 Minute synchronization time )

*/10 * * * * service ntpd start && /usr/sbin/ntpdate 192.168.1.1 >> /var/log/ntpdate.log

notes : Met ntp Can hang , Scheduled tasks can be set as follows

*/10 * * * * /usr/sbin/ntpdate 192.168.1.1 >> /var/log/ntpdate.log

原网站

版权声明
本文为[Lxinccode]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/159/202206082315279667.html