hadoop集群配置時間如何同步

2021-10-02 01:23:10 字數 2280 閱讀 4080

時間同步:配置一台伺服器a,讓其他的伺服器從伺服器a同步時間;以下配置均在root許可權下完成。

伺服器a的操作

第一步在伺服器a中 確保ntp服務已經安裝

在伺服器上查詢是否安裝ntp服務

[root@hadoop01 hadoop-2.7.2]

# rpm -qa | grep ntp

fontpackages-filesystem-1.41-1.1.el6.noarch

ntp-4.2.6p5-12.el6.centos.2.x86_64

ntpdate-4.2.6p5-12.el6.centos.2.x86_64

查詢ntp服務的狀態,確保ntp服務處於關閉狀態

[root@hadoop01 hadoop-2.7.2]

# service ntpd status

ntpd (pid 9137) is running...

[root@hadoop01 hadoop-2.7.2]

# service ntpd stop

shutting down ntpd: [ ok ]

[root@hadoop01 hadoop-2.7.2]

# service ntpd status

ntpd is stopped

第二步 修改ntp配置

[root@hadoop01 hadoop-2.7.2]

# vim /etc/ntp.conf

將以下**

#restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap..

.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

..

修改為(授權192.168.1.0-192.168.1.255網段上的所有機器可以從這台機器上查詢和同步時間 192.168.100.0是伺服器集群所在的網段)(集群在區域網中,不使用其他網際網路上的時間)

restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap..

.#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

fudge 127.127.1.0 stratum 10

第三步 修改vim /etc/sysconfig/ntpd

新增(讓硬體時間與系統時間一起同步)

sync_hwclock=yes
重新啟動ntp服務,並設定為開機自啟

[root@hadoop01 hadoop-2.7.2]

# service ntpd start

starting ntpd: [ ok ]

[root@hadoop01 hadoop-2.7.2]

# chkconfig ntpd on

[root@hadoop01 hadoop-2.7.2]

# chkconfig ntpd --list

ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

其他伺服器的操作

建立定時任務 [root@hadoop02 hadoop01]# crontab -e

*/10 ***

*/usr/sbin/ntpdate hadoop01

完成

Hadoop集群是配置時間同步!

hadoop集群是配置時間同步!時間同步 hadoop1 192.168.100.101 hadoop2 192.168.100.102 hadoop3 192.168.100.103 一 設定master的時間 選擇時區 修改時間 date s 00 00 00或者網路同步 apt get ins...

Hadoop集群配置

hadoop的配置檔案分為兩類 1.唯讀型別的預設檔案 src core core default.xml src hdfs hfds default.xml src mapred mapred default.xml conf mapred queues.xml 2.定位設定 conf core ...

hadoop集群配置

建立目錄 修改 home hadoop hadoop 2.7.1 etc hadoop下的配置檔案 把配置好的hadoop傳送到從節點 如果沒有目錄,請新建,沒有jdk,請提前裝,路徑和master保持一致 scp r home hadoop hadoop 2.7.1 root centos02 h...