• 分布式集群时间同步


    分布式集群时间同步

    • 集群时间同步思路:找一台机器,做为时间服务器,所有的机器与这台集群时间进行定时同步,好比如每隔30分钟,同步一次。
    • 操作步骤思路:
    1.检测ntp是否安装
    2.修改ntp配置文件
    	修改授权网段(授权192.168.1.0-192.168.1.255)网段上所有机器可以从这台机器上查询和同步时间
    	集群在局域网中不使用其他互联网上时间
    	当该节点丢失网络连接,依然可以采用本地时间做为时间服务器为集群中其他节点提供时间同步。
    3.修改/etc/sysconfig/ntpd文件
    4.重启ntpd服务
    5.设置ntpd服务开机启动
    
    • 同步步骤
    yum install ntp
    
    vim /etc/ntp.conf
    修改1:
    	restrict 10.0.0.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 startum 10
    
    修改4:硬件时间保持一致
    	vim /etc/sysconfig/ntpd
    	添加: SYNC_HWCLOCK=yes
    启动ntpd
    	service ntpd start
    查看状态:
    	service ntpd status
    设置开机自启动ntpd:  chkconfig ntpd on
    
    • 其他机器
    编辑定时任务:
    crontab -e
    1/* * * * * /usr/sbin/ntpdate linux01   #没一分钟与linux01时间定时同步
    
    测试:
    	更改linux02机器时间
    	date -s "2010-10-10 10:10:10"
    	等待1分钟:
    	date 查看时间
    
  • 相关阅读:
    python excel 像 Excel 一样使用 python 进行数据分析
    ubuntu 系统分区
    ubuntu 配置和修改ip地址
    yum centos 修改镜像源
    centos6 安装 docker 问题
    Feign 的简单使用(2)
    feign client 的简单使用(1)
    xsync
    canal 配置
    javascript之DOM编程正则表达式引入
  • 原文地址:https://www.cnblogs.com/xujunkai/p/14143862.html
Copyright © 2020-2023  润新知