Linux时间同步

linux时间分为系统时间和系统内核(BIOS)时间

系统时间输入命令:date

系统内核时间输入命令:hwclock --show

虚拟机软件上安装linux系统后,系统时间和内核时间大多会有差异,怎么解决呢?

1.安装ntpd服务

  • yum -y install ntp
  • vi /etc/ntp.conf
#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 ntp.api.bz iburst #与上海电信时间同步服务器同步

或者输入命令 ntpdate ntp.api.bz(这种方式是临时的,最好设置一个crontab定时同步)

ps:ntp服务将系统时间与网络时间同步了,此时date命令显示网络时间

2.date和hwclock同步

  • hwclock --systohc

cluster上实现时间同步,在slaves节点修改ntp.conf,将上海时间同步服务器域名修改为master节点IP即可。


本篇博客写于安装CDH。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值