【Hadoop集群】四、时间同步

一、安装ntpd

1
2
3
4
5
6
yum install -y ntp ntpd
查看时区  要是csttimedatectl <br><br>修改时区timedatectl set-timezone  Asia/Shanghai<br>查看状态<br>sudo systemctl status ntpd
启动
sudo systemctl start ntpd
开机自启
sudo systemctl is-enabled ntpdhwclock -wsudo ntpdate 1.cn.pool.ntp.org

  

    sudo systemctl enable ntpd

 

 同步到硬件时间

   网络时间

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ sudo vim /etc/ntp.conf
 
     第一处:修改成自己的网段
 
     #Hosts on local network are less restricted.
 
     restrict 192.168.74.0 mask 255.255.255.0 nomodify notrap
 
     第二处:由于是内网环境,就不需要这些服务配置,注释
 
     # Please consider joining the pool  (http://www.pool.ntp.org/join.html).
 
     # server 0.centos.pool.ntp.org
 
     # server 1.centos.pool.ntp.org
 
     # server 2.centos.pool.ntp.org
 
     第三处:ntp server提供的本地服务
 
     server 127.127.1.0                     #local clock
 
     fudge 127.127.1.0   stratum  10

 

sudo vim /etc/sysconfig/ntpd

 

1
SYNC_HWCLOCK=yes

 

  

其他节点,同步第一台

先测试能不能同步时间

1
2
从机同步时间
sudo ntpdate hadoop101

再添加命令

sudo crontab -e

1
*/1 * * * * /usr/sbin/ntpdate hadoop101

  

posted @   持枢  阅读(149)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示