兩台虛擬機器
1、安裝ntp 服務192.168.30.139
# 服務端
192.168.30.143
# 客戶端
2、服務並設定開機啟動# 192.168.30.139
[root@hadoop1 opt]# yum install -y ntp
# 192.168.30.143
[root@hadoop2 opt]# yum install -y ntp
3、 檢視埠是否啟動[root@hadoop1 opt]# service ntpd start
# 正在啟動 ntpd: [確定]
[root@hadoop1 opt]# chkconfig ntpd on
4、修改配置檔案:[root@hadoop1 ~]# netstat -anput| grep 123
udp 0
0192.168.30.139
:123
0.0.0.0
:*8239/ntpd
udp 0
0127.0.0.1
:123
0.0.0.0
:*8239/ntpd
udp 0
00.0.0.0
:123
0.0.0.0
:*8239/ntpd
udp 0
0fe80::20
c:29
ff:fea8:
b66b:
123:::*
8239/ntpd
udp 00:
:1:123::
:*8239/ntpd
udp 00:
::123:::*
8239/ntpd
5、 重啟ntpd服務driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0
.0.1
restrict -6 ::1
#允許192.168.30.0網段進行訪問
restrict 192.168
.30.0 mask 255.255
.255
.0server 127.127
.1.0
fudge 127.127
.1.0 stratum 10
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
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
1、 在192.168.30.143進行如上的一樣操作[root@hadoop1 ~]# service
ntpd
restart
關閉 ntpd: [確定]
正在啟動 ntpd: [確定]
客戶端不需要重啟。。。
1、測試之前,要檢測是否防火牆、selinux 都關閉!!!
2、時間同步#防火牆關閉
[root@hadoop1 opt]# service iptables stop
#selinux關閉
[root@hadoop1 opt]# cat /etc/selinux/config |grep -v ^#
selinux=disabled
selinuxtype=targeted
[root@hadoop1 opt]# date
2023年 12月 17日 星期日 03:33:13 cst
# 設定hadoop2上時間與hadoop1上有明顯區別
[root@hadoop2 ~]# date -s '2017-12-10 15:14:23'
2023年 12月 10日 星期日 15:14:23 cst
#執行同步指令
[root@hadoop2 ~]# ntpdate 192.168.30.139
17 dec 03:35:11 ntpdate[4405]: step time server 192.168.30.139 offset 562786.980472 sec
[root@hadoop2 ~]# date
2023年 12月 17日 星期日 03:35:12 cst
# 每天零點同步資訊
[root@hadoop2 ~]# crontab -e
00 * * * ntpd 192.168.30.139
NTP時間伺服器
ntp network time protocol 網路時間協議,工作在udp的123埠上。是用來使計算機時間同步化的一種協議,它可以使計算機對其伺服器或時鐘源 如石英鐘,gps等等 做同步化,它可以提供高精準度的時間校正 區域網上與標準間差小於1毫秒,網際網路上幾十毫秒 且可介由加密確認的方式來防...
時間伺服器 NTP
本文主要從ntp通訊協議 ntp伺服器的階層概念 ntp伺服器的安裝與設定 client的安裝和配置 ntp的啟動與觀察等幾個方面詳細介紹了ntp伺服器。初探firewalld 計算機內部所記錄的的時鐘都記載於bios cmos 內的,但如果計算機上面的cmos電池沒電了,或者是某些特殊因素導致bi...
NTP時間伺服器
yum安裝ntp和ntpdate root localhost yum y install ntp ntpdate修改配置檔案,加入以下兩行,其他server 號注釋 root localhost vim etc ntp.conf server 127.127.1.0 fudge 127.127.1...