linux/centos/集群安装ntp时间同步,自身实验成功
生活随笔
收集整理的這篇文章主要介紹了
linux/centos/集群安装ntp时间同步,自身实验成功
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1. 準備節(jié)點
不管你有多少個節(jié)點,肯定要有一個 server 角色,至于誰是 server 你來決定。
例如下面這樣,我們姑且假設有這樣四個節(jié)點
2. 安裝配置 server 節(jié)點
在192.168.11.101端作為服務端,并在該節(jié)點進行以下步驟
2.1 下載安裝
[root@node1 ~]# yum install ntp ntpdate并將該服務器同步阿里云服務器網(wǎng)站
[root@node1 ~]# ntpdate ntp1.aliyun.com2.2 編輯配置文件
[root@node1 ~]# vim /etc/ntp.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 iburst在下面再添加一行,代表本機作為服務器,不要懷疑下面的127.127.1.0寫錯了,沒有,就這樣來。
#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 iburst server 127.127.1.0 iburst2.3 啟動服務
[root@node1 ~]# systemctl start ntpd [root@node1 ~]# systemctl enable ntpd.service #設置開機啟動服務2.4 查看狀態(tài)
[root@node1 ~]# systemctl status ntpd ● ntpd.service - Network Time ServiceLoaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)Active: active (running) since Tue 2020-02-11 19:38:22 CST; 19s agoMain PID: 1491 (ntpd)CGroup: /system.slice/ntpd.service└─1491 /usr/sbin/ntpd -u ntp:ntp -gFeb 11 19:38:22 cdh1 ntpd[1491]: Listen and drop on 1 v6wildcard :: UDP 123 Feb 11 19:38:22 cdh1 ntpd[1491]: Listen normally on 2 lo 127.0.0.1 UDP 123 Feb 11 19:38:22 cdh1 ntpd[1491]: Listen normally on 3 ens33 192.168.0.108 UDP 123 Feb 11 19:38:22 cdh1 ntpd[1491]: Listen normally on 4 lo ::1 UDP 123 Feb 11 19:38:22 cdh1 ntpd[1491]: Listen normally on 5 ens33 fe80::e37b:3e48:9646:7eff UDP 123 Feb 11 19:38:22 cdh1 ntpd[1491]: Listening on routing socket on fd #22 for interface updates Feb 11 19:38:22 cdh1 ntpd[1491]: 0.0.0.0 c016 06 restart Feb 11 19:38:22 cdh1 ntpd[1491]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM Feb 11 19:38:22 cdh1 ntpd[1491]: 0.0.0.0 c011 01 freq_not_set Feb 11 19:38:23 cdh1 ntpd[1491]: 0.0.0.0 c514 04 freq_mode3. 安裝配置 Client 節(jié)點
下面描述是在node2上進行的,也要在分別在node3或者有其他結點的下面都要執(zhí)行一邊下面操作
3.1 下載安裝
[root@node2 ~]# yum install ntp ntpdate3.2 編輯配置文件
[root@node2 ~]# vim /etc/ntp.conf3.3 配置ntp服務器
[root@node2 ~]# vim /etc/ntp.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 iburstnode2和node3都在下面再添加
#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 iburst server 192.168.11.101 #配置本地ntp服務器為時間同步服務器 restrict 192.168.11.101 nomodify notrap noquery #允許本地時間服務器主動修改本機的時間3.4 同步時間
[root@node2 ~]# ntpdate -d -b 192.168.11.1013.5 啟動服務
[root@node2 ~]# systemctl start ntpdate [root@node2 ~]# systemctl enable ntpdate.service #設置開機啟動服務4. 測試
所有節(jié)點執(zhí)行 date 命令看時間是否一致即可。
總結
以上是生活随笔為你收集整理的linux/centos/集群安装ntp时间同步,自身实验成功的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 原创:啊?两年了,她才彻底摆脱这段婚姻啊
- 下一篇: 给hbase增加协处理器报ERROR: