【Hadoop集群】四、时间同步


一、安装ntpd


yum install -y ntp ntpd



查看时区 要是cst
timedatectl 

修改时区
timedatectl set-timezone  Asia/Shanghai


查看状态
sudo systemctl status ntpd 启动 sudo systemctl start ntpd 开机自启 sudo systemctl is-enabled ntpd

    sudo systemctl enable ntpd

 同步到硬件时间

网络时间

sudo ntpdate 1.cn.pool.ntp.org
hwclock -w

配置

     $ 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 ntpdate hadoop101