linux 校准时间

最近在做一个项目,发现本地测试数据的之间一直是正确的,但是线上的测试数据时间总是出问题。排除代码问题,那么可能是服务器时间不准确

date

查看时间后发现果然时间有问题

yum install ntp #安装ntpdate
ntpdate cn.pool.ntp.org

在运行上述指令的过程中,发现总是有下述错误

[root@xxx]# ntpdate  cn.pool.ntp.org
23 Jul 08:30:52 ntpdate[1548]: sendto(time6.aliyun.com): Operation not permitted
23 Jul 08:30:52 ntpdate[1548]: sendto(ntp-sz.chl.la): Operation not permitted
23 Jul 08:30:52 ntpdate[1548]: sendto(dns1.synet.edu.cn): Operation not permitted
23 Jul 08:30:53 ntpdate[1548]: sendto(time6.aliyun.com): Operation not permitted
23 Jul 08:30:53 ntpdate[1548]: sendto(ntp-sz.chl.la): Operation not permitted
23 Jul 08:30:53 ntpdate[1548]: sendto(dns1.synet.edu.cn): Operation not permitted
23 Jul 08:30:54 ntpdate[1548]: sendto(time6.aliyun.com): Operation not permitted
23 Jul 08:30:54 ntpdate[1548]: sendto(ntp-sz.chl.la): Operation not permitted
23 Jul 08:30:54 ntpdate[1548]: sendto(dns1.synet.edu.cn): Operation not permitted
23 Jul 08:30:55 ntpdate[1548]: sendto(time6.aliyun.com): Operation not permitted
23 Jul 08:30:55 ntpdate[1548]: sendto(ntp-sz.chl.la): Operation not permitted
23 Jul 08:30:55 ntpdate[1548]: sendto(dns1.synet.edu.cn): Operation not permitted
23 Jul 08:30:56 ntpdate[1548]: no server suitable for synchronization found

一番折腾后,发现是防火墙问题

service iptables stop # 关闭防火墙
ntpdate  cn.pool.ntp.org # 同步时间
service iptables start # 开启防火墙
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值