• Hadoop集群搭建--时间同步


    关注微信公共号:小程在线

     

    关注CSDN博客:程志伟的博客

    如果服务器在公网环境(能连接外网),可以不采用集群时间同步

    需要使用root用户

    1.查看所有节点ntpd服务状态和开机自启动状态

    [root@hadoop102 atguigu]# systemctl status ntpd

    [root@hadoop102 atguigu]# systemctl start ntpd
    [root@hadoop102 atguigu]# systemctl status ntpd

    开机启动ntpd

    [root@hadoop102 atguigu]# systemctl is-enabled ntpd
    disabled

    2. 修改hadoop102的ntp.conf配置文件

    修改1:

    #restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap修改为:

    restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap

    修改2:

    下面这几个都是在前面加上#

    #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

    修改3:

    在文件的最后增加:

    server 127.127.1.0

    fudge 127.127.1.0 stratum 10

    3.修改/etc/sysconfig/ntpd 文件

    [root@hadoop102 atguigu]# vim /etc/sysconfig/ntpd

    4.重启

    [root@hadoop102 atguigu]# systemctl restart ntpd

    5.设置开机启动

    [root@hadoop102 atguigu]# systemctl enable ntpd
    Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

    6.修改103的时间

    关闭所有节点上ntp服务和自启动

    [atguigu@hadoop103 module]$ sudo systemctl stop ntpd
    [atguigu@hadoop103 module]$ sudo systemctl disable ntpd

    在其他机器配置1分钟与时间服务器同步一次
    [atguigu@hadoop103 module]$ sudo crontab -e
    crontab: installing new crontab


    [atguigu@hadoop103 module]$ date
    2022年 05月 10日 星期二 16:39:57 CST

    修改任意机器时间
    [atguigu@hadoop103 module]$ sudo date -s "2021-9-11 11:11:11"
    2021年 09月 11日 星期六 11:11:11 CST
    [atguigu@hadoop103 module]$ date
    2021年 09月 11日 星期六 11:11:36 CST

    1分钟后查看机器是否与时间服务器同步
    [atguigu@hadoop103 module]$ date
    2022年 05月 10日 星期二 16:46:04 CST

  • 相关阅读:
    ChatGPT突然上线APP!iPhone可用、速度更快,GPT-4用量限制疑似取消
    深入理解Redis
    网络安全(黑客)自学
    9、统一记录日志(AOP)
    基于SSM的健身房管理系统
    数仓工具—Hive进阶之表设计最佳实践(21)
    天津化工杂志天津化工杂志社天津化工编辑部2022年第3期目录
    Python自动化操作sqlite数据库
    rmq nameserver
    dp练习2
  • 原文地址:https://blog.csdn.net/c1z2w3456789/article/details/124690505