美文网首页
同步服务器时间

同步服务器时间

作者: 胖虎喜欢小红 | 来源:发表于2020-02-19 18:16 被阅读0次

生产中服务器时间同步还是比较重要的,一般都不会去专门搭建NTP服务器,可以直接使用公网上的NTP服务器去同步服务器时间

1、查看时区

+0800代表的就是中国的时区

[root@linux ~]# date -R
Wed, 19 Feb 2020 18:00:31 +0800

2、同步时间

直接在网上搜索NTP服务器
阿里云的NTP服务器ntp1.aliyun.com

使用ntp工具同步时间
[root@linux ~]# yum -y install ntpdate
[root@linux ~]# ntpdate ntp1.aliyun.com
19 Feb 18:11:38 ntpdate[3580]: step time server 120.25.115.20 offset -1.606375 sec

如果时区错误:

[root@linux ~]# date -R
Mon, 20 Nov 2017 19:33:48 -0800 --这是查看为错误的因为中国时间为亚洲+0800才对


如果要修改时区,执行sudo tzselect
选择区域:亚洲
[root@linux ~]# sudo tzselect

Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) coord - I want to use geographical coordinates.
12) TZ - I want to specify the time zone using the Posix TZ format.
#? 5

选择国家:中国
Please select a country whose clocks agree with yours.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 9

选择时区:北京时间
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time
#? 1

确认验证:
The following information has been given:

China
Beijing Time

Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Tue Nov 21 11:34:46 CST 2017.
Universal Time is now: Tue Nov 21 03:34:46 UTC 2017.
Is the above information OK?
1) Yes
2) No
#? 1

复制文件到/etc目录下
[root@linux ~]# cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime
更新时间
[root@linux ~]# yum -y install ntpdate
[root@linux ~]# ntpdate ntp1.aliyun.com

相关文章

  • 服务器时间同步、修改docker时区

    《服务器时间同步、修改docker时区》 一、服务器时间同步 安装ntp服务 时间同步命令 修改时区 二、linu...

  • Linux时间同步

    服务器同步网络时间

  • Linux 时间同步

    Linux 服务器可以通过命令来进行时间同步。 一、ntpdate 同步网络时间 NTP 常用服务器: 经测试中国...

  • Linux服务器时间同步(多台)

    服务器时间与标准时间不同步?不同服务器之间时间不同步?简单操作几下就OK 直接上货 1.在配置时间同步环境的时候要...

  • CentOS 7.x系统优化指南

    集群时间同步: 参考链接:Linux Chrony 设置服务器集群同步时间[https://www.linuxpr...

  • Linux同步服务器时间

    Linux同步服务器时间 CentOS安装ntp时间同步服务[https://blog.csdn.net/yinj...

  • Windows同步服务器时间

    Windows同步服务器时间 CentOS安装ntp时间同步服务[https://blog.csdn.net/yi...

  • 同步服务器时间

    生产中服务器时间同步还是比较重要的,一般都不会去专门搭建NTP服务器,可以直接使用公网上的NTP服务器去同步服务器...

  • 时间同步服务器

    时间同步服务器 [toc]因搭建 ceph 集群要求时间稳定.再次回顾下两种时间服务器的部署.推荐使用chrony...

  • linux时间同步

    安装同步模块 以下是几个时间服务器

网友评论

      本文标题:同步服务器时间

      本文链接:https://www.haomeiwen.com/subject/pwzafhtx.html