之前已经使用ansible 批量安装部署启动过ntp
安装:ansible -i sms_addtikv.txt all -m shell -a \"sudo yum install ntp ntpdate -y\" -b
启动:ansible -i sms_addtikv.txt all -m shell -a \"sudo systemctl start ntpd.service \" -b
但是ansible-playbook deploy.yml 安装tikv时还是报错:
ERROR MESSAGE SUMMARY ********************************************************************************************************************************************************************************************************************************************************
[172.168.34.89]: Ansible FAILED! => playbook: deploy.yml; TASK: check_system_dynamic : Preflight check - NTP service; message: {\"changed\": false, \"msg\": \"Make sure NTP service is running and ntpstat is synchronised to NTP server. See https://github.com/pingcap/docs/blob/master/op-guide/ansible-deployment.md#how-to-check-whether-the-ntp-service-is-normal .\"}
[172.168.34.72]: Ansible FAILED! => playbook: deploy.yml; TASK: check_system_dynamic : Preflight check - NTP service; message: {\"changed\": false, \"msg\": \"Make sure NTP service is running and ntpstat is synchronised to NTP server. See https://github.com/pingcap/docs/blob/master/op-guide/ansible-deployment.md#how-to-check-whether-the-ntp-service-is-normal .\"}
先查看ntp状态
[ansible@st300-hytikv-64] ~$ ntpstat
unsynchronised
polling server every 64 s
没有同步好,接下来手动再操作下
[ansible@st300-hytikv-64] ~$ ntpstat
unsynchronised
time server re-starting
polling server every 8 s
[ansible@st300-hytikv-64] ~$
[ansible@st300-hytikv-64] ~$ sudo systemctl stop ntpd.service
[ansible@st300-hytikv-64] ~$ sudo ntpdate pool.ntp.org
26 Oct 16:28:52 ntpdate[31699]: adjust time server 5.103.139.163 offset 0.001772 sec
[ansible@st300-hytikv-64] ~$ sudo systemctl start ntpd.service
[ansible@st300-hytikv-64] ~$
[ansible@st300-hytikv-64] ~$
[ansible@st300-hytikv-64] ~$ ntpstat
synchronised to NTP server (193.228.143.13) at stratum 3
time correct to within 170 ms
polling server every 64 s
[ansible@st300-hytikv-64] ~$
番外:
一般的执行如下命令,基本可以搞定
| $ sudo systemctl stop ntpd.service $ sudo ntpdate pool.ntp.org $ sudo systemctl start ntpd.service |
|---|
有时候centos7系统不行,采用下面命令
| $ sudo yum install ntp ntpdate $ sudo systemctl start ntpd.service $ sudo systemctl enable ntpd.service |
|---|
之后再执行 ansible-playbook deploy.yml命令,就会畅通无阻,顺利执行完成。
继续阅读与本文标签相同的文章
以区块链技术促进纳税遵从的设想
-
2019云栖大会 | 究竟哪款NoSQL数据库最适合你?
2026-05-18栏目: 教程
-
CNCF 宣布成立应用交付领域小组,正式开启云原生应用时代
2026-05-18栏目: 教程
-
蚂蚁金服体验科技精选1-3期
2026-05-18栏目: 教程
-
9月新规1天顶平时1个月的收入,消费再少也有返利? 再创日赚万元的日子迎接双11
2026-05-18栏目: 教程
-
《Apache Kafka实战》| 每日读本书
2026-05-18栏目: 教程
