In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Time service and chrony
Multi-host cooperation is that the time synchronization of each host is very important, and the inconsistency of time will cause the failure of many important applications, such as encryption protocol, log, cluster and so on. NTP protocol is used to synchronize the time of each computer in the network. At present, NTP protocol is one of the necessary basic services in the infrastructure of operation and maintenance.
Implementation of time synchronization: ntp,chronyntp
Ntp synchronizes the system time with the world time UTC, and the accuracy can reach 0.1ms in the local area network and 1-50ms in most places on the Internet. Currently, ntp services are used on CentOS6.
Experimental description of the deployment of the experimental ntp
Host A synchronizes time from the host on the Internet and uses it as a time server in the local area network. Host B automatically synchronizes time with host A.
Experimental preparation
Prepare two hosts An and B
Slow down host B time [root@HostB ~] # date-s "- 10 days" Sun Apr 7 10:50:51 CST 2019 [root@HostB ~] # dateSun Apr 7 10:50:58 CST 2019 check host A time [root@HostA ~] # dateWed Apr 17 10:53:35 CST 2019 1, set host An as the time server
1. Modify / etc/ntp
[root@HostA ~] # vim / etc/ntp.conf... # restrict default kod nomodify notrap nopeer noquery # comment this line in the file Or modify the following line restrict default kod nomodify. # server 0.centos.pool.ntp.org iburst#server 1.centos.pool.ntp.org iburst#server 2.centos.pool.ntp.org iburst#server 3.centos.pool.ntp.org iburstserver 172.22.0.1 iburst# to point the time server to an external time server. ...
two。 Synchronize host A with the time server of the external network
[root@HostA] # ntpdate 172.22.0.118 Apr 10:27:53 ntpdate [3825]: adjust time server 172.22.0.1 offset 0.004437 sec
3. Start the ntp service and set the ntp service to boot
[root@HostA ~] # service ntpd startStarting ntpd: [OK] [root@HostA ~] # chkconfig ntpd on II. Modify the configuration file of host B to automatically synchronize with host A.
1. Modify the configuration file to point the time server to host A
# server 0.centos.pool.ntp.org iburst#server 1.centos.pool.ntp.org iburst#server 2.centos.pool.ntp.org iburst#server 3.centos.pool.ntp.org iburstserver 192.168.73.140 iburst# add this line
two。 Start the service
[root@HostB ~] # service ntpd startStarting ntpd: [OK] [root@HostB ~] because the synchronization speed of ntp service is slow It takes a long time to synchronize and press Mon Apr 8 10:34:43 CST 2019 [root@HostB ~] # service ntpd restartShutting down ntpd: [OK] Starting ntpd: [OK] [root@HostB ~] restart the service again The time has been automatically synchronized at this time. Thu Apr 18 10:34:54 CST 2019CentOS7 chrony Lab chrony deployment Lab instructions:
Here, host An is the time server in the Internet. Host 7A synchronizes time from host An and is used as a time server in the local area network. Host 7B automatically synchronizes time with host 7A.
Experimental preparation
7A and 7B mainframe
Configure the time server
1. Modify host 7A configuration file modify / etc/chrony.conf
[root@7a ~] # vim / etc/chrony.conf...server 192.168.73.140 iburst # add this line to a time server in the network... allow 192.168.73.0 take 24 # add a network segment that you are allowed to access when you are a time server... local stratum 10 # remove the comments before this line
two。 Start the chronyd service and set it to boot
[root@7a] # systemctl start chronyd.service [root@7a] # systemctl enable chronyd.serviceCreated symlink from / etc/systemd/system/multi-user.target.wants/chronyd.service to / usr/lib/systemd/system/chronyd.service. Configure the server in the local area network and point the time server to 7A
1. Modify the configuration file
[root@7b ~] # vim / etc/chrony.conf # server 0.centos.pool.ntp.org iburst#server 1.centos.pool.ntp.org iburst#server 2.centos.pool.ntp.org iburst#server 3.centos.pool.ntp.org iburstserver 192.168.73.150 iburst# add this line
two。 Start the chrony service and set it to boot automatically
[root@7b] # systemctl start chronyd [root@7b] # systemctl enable chronydCreated symlink from / etc/systemd/system/multi-user.target.wants/chronyd.service to / usr/lib/systemd/system/chronyd.service.
3. Check time synchronization
[root@7b ~] # chronyc sources210 Number of sources = 1MS Name/IP address Stratum Poll Reach LastRx Last sample = ^ * 192.168.73.150 56 17731 + 50us [+ 77us] + /-218ms [root@7b ~] #
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.