openstack swift 对各个节点的时钟同步有着较强的要求,所以需要在系统中配置时钟同步。
1.选择一台主机作为服务器,配置 ntp
1.1 安装
1 | yum install -y ntp |
1.2 编辑 /etc/ntp.conf
1 | #服务默认拒绝所有NTP连线 |
1.3 同步更新hwclock
编辑 /etc/sysconfig/ntpd:
1 | SYNC_HWCLOCK=yes |
1.4 启动
1 | sudo systemctl restart ntpd.service |
1.5 加入开机启动
1 | sudo chkconfig ntpd on |
2. 客户端同步时间
2.1 同步
1 | ntpdate 192.168.0.128 |
192.168.0.128
是搭建 ntp 服务的机器的 ip。
2.2 加入任务计划
每天凌晨一点同步:
1 | crontab -e |