本文使用两节点虚拟机集群环境介绍如何配置本地时钟服务器,两台机器分别为,

192.168.1.93    openstack-1.novalocal   openstack-1
192.168.1.94    openstack-2.novalocal   openstack-2

这里假设我们以openstack-1为本地时钟服务器,openstack-2与opentack-1进行时钟同步,步骤如下,

1 确保ntpd关闭状态

[root@openstack-1 ~]# service ntpd stop
Shutting down ntpd:                                        [  OK  ]
[root@openstack-1 ~]# service ntpd status
ntpd is stopped

[root@openstack-2 ~]# service ntpd stop
Shutting down ntpd:                                        [  OK  ]
[root@openstack-2 ~]# service ntpd status
ntpd is stopped

2 配置openstack-1,编辑/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 127.127.1.0 iburst

3 配置openstack-2,编辑/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 192.168.1.93 iburst

4 使用ntpdate同步openstack-2与openstack-1时间,报错如下

root@openstack-2 ~]# ntpdate -u openstack-1
 8 Aug 15:06:57 ntpdate[12705]: no server suitable for synchronization found

5 启动openstack-1上面的ntp服务并在openstack-2上重新ntpdate

[root@openstack-1 ~]# service ntpd start
Starting ntpd:                                             [  OK  ]
You have mail in /var/spool/mail/trafodion
[root@openstack-1 ~]#
[root@openstack-1 ~]#
[root@openstack-1 ~]# service ntpd status
ntpd (pid  62422) is running...

[root@openstack-2 ~]# ntpdate -u openstack-1
 8 Aug 15:07:14 ntpdate[12852]: adjust time server 192.168.1.93 offset 0.001302 sec

6 启动openstack-2上面的ntpd服务

[root@openstack-2 ~]# service ntpd start
Starting ntpd:                                             [  OK  ]
[root@openstack-2 ~]# service ntpd status
ntpd (pid  13299) is running...

至此,本地时钟服务器已经配置完成,欢迎指正!

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐