Linux时钟同步服务器配置

1、集群时间同步(主节点)

1.1 rpm -qa |grep ntpd 》》没有安装则需要安装此服务 》》yum install ntp
 
2.2 vi /etc/ntp.conf
	去掉这个注释,将地址改成网段地址
	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.asia.pool.ntp.org
    server 3.asia.pool.ntp.org
    restrict 0.asia.pool.ntp.org nomodify notrap noquery
    restrict 3.asia.pool.ntp.org nomodify notrap noquery
	server 127.127.1.0
	fudge  127.127.1.0  stratum 10

1.3 vi /etc/sysconfig/ntpd  加入下面一句话,用于配置boot时间和系统时间同步
	SYNC_HWCLOCK=yes


1.4 启动ntpd服务器	
    ntpdate -u 3.asia.pool.ntp.org
	sudo service ntpd start
	sudo service ntpd status
	chkconfig ntpd on
	chkconfig --list |grep ntpd

2、客户机配置(从节点)

	2.1 使用 root用户操作
    去掉这个注释,将地址改成网段地址
	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
    
    
    
    添加一下内容(下边的192.168.1.46表示主节点地址)
    server 192.168.1.46 
    restrict 192.168.1.46 nomodify notrap noquery
    server  127.127.1.0     # local clock
    fudge   127.127.1.0 stratum 10
    
    2.2 启动ntpd客服端	

    ntpdate -u 192.168.1.46
	sudo service ntpd start
	sudo service ntpd status
	chkconfig ntpd on
	chkconfig --list |grep ntpd
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值