• 集群时间同步


    1、查看本机是否安装了ntpdate服务,安装 时间同步软件

    ​   yum install -y ntpdate

       yum install -y ntp

    2、同步时间

    ​   ntpdate time.nist.gov // 同步时间

    ​   如果同步不了

    ​   ntpdate time.nuri.net // 校验时间 系统时间

      ​ 把系统时间写入硬件时间

    ​   hwclock -w // 写入时间

    -----------------------------------------------------------------------

    1、修改时区

      命令:tzselect

    ​   选择 5 亚洲

    ​   9 中国

    ​   1 北京

      简单做法:

      cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime // 修改时区为上海

    2、集群同步时间:必须是root用户

      1、没有ntp的安装ntp

        rpm -qa | grep ntp // 查看是否安装

      2、修改配置文件

        vim /etc/ntp.conf

    #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 为
    restrict 192.168.1.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 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

      3、修改 /etc/sysconfig/ntpd

      加上:SYNC_HWCLOCK=yes

      4、重新启动ntpd,添加开机启动

    service ntpd status
    service ntpd start
    --------------------
    添加到开机启动
    chkconfig ntpd on

      5、其他机器配置定时任务,10分钟 同步一次

    crontab -e  编写定时器同步时间, 意义:每十分钟与node1 同步一次时间。
    需要在集群中其他的机器中都编写 crontab -e
    */10 * * * * /ntpdata hadoop01
  • 相关阅读:
    c#获取指定时区的日期
    项目版本管理
    iis部署网站
    浏览器测试string是否为图片
    网站中挂视频
    百度地图调用
    mvc actionresult返回各种文件
    Coursera机器学习week7 单元测试
    Coursera机器学习week7 笔记
    牛客练习赛12 AB
  • 原文地址:https://www.cnblogs.com/dongxiucai/p/9671599.html
Copyright © 2020-2023  润新知