当前位置: 首页 > news >正文

电子商务网站建设主管的策划案江苏建设管理信息网站

电子商务网站建设主管的策划案,江苏建设管理信息网站,做告状网站,做网站用什么语言好服务器时钟同步 文章目录 服务器时钟同步背景windows时钟同步Linux机器上的时钟同步Centos时钟同步Ubuntu系统时钟同步 查看是否同步的命令 背景 运维,XXX服务器慢了2秒,导致XXX业务没有正常执行,请立即排查为啥会有时钟不同步的问题。 首先…

服务器时钟同步

文章目录

  • 服务器时钟同步
    • 背景
    • windows时钟同步
    • Linux机器上的时钟同步
      • Centos时钟同步
      • Ubuntu系统时钟同步
    • 查看是否同步的命令

背景

@运维,XXX服务器慢了2秒,导致XXX业务没有正常执行,请立即排查为啥会有时钟不同步的问题。
首先说下时间为啥会不准,时间不准的原因有很多,有以下几种可能

  1. 硬件时钟故障
  2. BIOS的电池故障
  3. 时钟同步问题

还有很多问题,总而言之就是时间不准确了,怎么能将时间尽可能的标准呢,来看看我们遇到的问题。

windows时钟同步

首先将自动设置时间要打开
在这里插入图片描述
设定要同步的的服务器,可以选择官方的也可以选择自己的同步服务器,但记得要先telnet一下,端口是123
在这里插入图片描述
默认同步时间是1天1次,本次同步结束后,24小时后再同步一次
如果机器对时间的要求比较严格,要进行定时同步时间,设置定时同步可以这么设置
找到任务计划程序(我不知道哪里进,点了win搜索就是了)
创建个目录或者在
\Microsoft\Windows\Time Synchronization
目录下设置时间同步
在这里插入图片描述
设置任务的目的主要是执行命令
设置触发器,选定你要同步的时间,跟Linux里的crontab有点相似,这个是界面的,更容易理解
在这里插入图片描述
主要是操作这些
在这里插入图片描述
同步时间的命令

w32tm /resync

检查windows中时差的命令是

# 203.107.6.88是阿里云的时钟服务器
cmd /k "w32tm /stripchart /computer:203.107.6.88 /samples:2 /dataonly"

也可以采用微软的服务器,自己公司内部的服务器

如果需要看到时间差的情况,可以使用钉钉、飞书、邮件等相关软件进行及时通知,或者超过某个阈值的时候进行通知,这些都是可行的。一般只要时间同步问题就不大。

Linux机器上的时钟同步

Centos时钟同步

采用Centos默认的时钟同步策略,在装系统时已经装了,查看其命令的

# 查看chronyd的状态
[root@localhost log]# systemctl status chronyd
● chronyd.service - NTP client/serverLoaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)Active: active (running) since Fri 2023-07-21 18:35:48 CST; 2 weeks 0 days agoDocs: man:chronyd(8)man:chrony.conf(5)Process: 1593 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)Process: 1569 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS)Main PID: 1585 (chronyd)Tasks: 1CGroup: /system.slice/chronyd.service└─1585 /usr/sbin/chronydJul 21 18:35:48 localhost systemd[1]: Starting NTP client/server...
Jul 21 18:35:48 localhost chronyd[1585]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECH...6 +DEBUG)
Jul 21 18:35:48 localhost  chronyd[1585]: Frequency 4.080 +/- 0.147 ppm read from /var/lib/chrony/drift
Jul 21 18:35:48 localhost systemd[1]: Started NTP client/server.
Jul 21 18:35:58 localhost chronyd[1585]: Selected source 193.182.111.12
Jul 21 18:35:59 localhost chronyd[1585]: Selected source 202.38.64.7
Jul 21 18:36:02 localhost chronyd[1585]: Source 193.182.111.12 replaced with 84.16.73.33
Jul 26 17:50:53 localhost chronyd[1585]: Source 202.112.29.82 replaced with 119.28.206.193
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost log]# 

配置文件在

[root@localhost etc]# vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 所需同步服务器的域名
server 0.centos.pool.ntp.org iburst
……# Record the rate at which the system clock gains/losses time.
# driftfile指定了用于记录系统时钟的漂移量的文件路径。Chrony使用该文件来记录系统时钟的精度和准确度,以便在下次启动时进行校准。
driftfile /var/lib/chrony/drift# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
# makestep配置指定了系统时钟在前三次更新时是否允许快速调整(stepping),当系统时钟的偏差超过1秒时,允许进行快速调整。
makestep 1.0 3# Enable kernel synchronization of the real-time clock (RTC).
# rtcsync启用了对硬件RTC(实时时钟)的内核同步。Chrony将尝试让系统时钟和硬件RTC保持同步。

其中要注意,同步的服务器要保证和是能通信的

Ubuntu系统时钟同步

(base) test@localhost:~$ systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time SynchronizationLoaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)Active: active (running) since Mon 2023-07-24 18:28:19 CST; 1 week 4 days agoDocs: man:systemd-timesyncd.service(8)Main PID: 838 (systemd-timesyn)Status: "Initial synchronization to time server 185.125.190.57:123 (ntp.ubuntu.com)."Tasks: 2 (limit: 57665)Memory: 964.0KCPU: 3.313sCGroup: /system.slice/systemd-timesyncd.service└─838 /lib/systemd/systemd-timesyncdWarning: some journal files were not opened due to insufficient permissions.

Ubuntu 默认同步的主机是pool.ntp.org
默认同步时间最大是2048秒,最小同时间隔是32秒,大约每间隔1分钟同步一次

查看是否同步的命令

无论Ubuntu还是Centos查看是否同步的命令都是
乌班图查看

(base) test@localhost:/etc$ timedatectlLocal time: Fri 2023-08-04 19:30:36 CSTUniversal time: Fri 2023-08-04 11:30:36 UTCRTC time: Fri 2023-08-04 11:30:36Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yesNTP service: activeRTC in local TZ: no
(base) test@localhost:/etc$ 

Centos查看

[root@localhost ~]# timedatectlLocal time: Fri 2023-08-04 19:31:20 CSTUniversal time: Fri 2023-08-04 11:31:20 UTCRTC time: Fri 2023-08-04 11:31:20Time zone: Asia/Shanghai (CST, +0800)NTP enabled: yes
NTP synchronized: yesRTC in local TZ: noDST active: n/a
[root@localhost ~]# 

计算机不是机械的,没有大自然的神奇,底层是电压的高低位模拟出来的,未免有偏差,偏差只要做好同步和监控,时间偏差会降到最低,防止因为时间偏差带来的麻烦。

http://www.yayakq.cn/news/372241/

相关文章:

  • 网站会员注册系统推荐常州网站建设公司
  • 网站被k多久恢复保定网站设计概述
  • 做网站的域名多少钱成都网站优化哪家好
  • 河北 石家庄 网站建设wordpress删除页头页尾
  • linux wordpress 建站教程山东建设银行官网网站
  • 网站建设信息推荐房地产迎来4个好消息
  • 第三方做公司网站php网站开发工资多少钱
  • 网站开发建设价格附件网站建设应该注意哪些原则
  • 安平营销型网站建设费用天津网站建设招聘
  • 百度公司网站制作html5 制作手机网站
  • 礼品行业网站建设盗qq的钓鱼网站怎么做
  • 革吉网站建设小说网站排名
  • 如何创建百度网站网络推广方法的分类
  • 网站建设需要学什么语言saas搭建
  • 火龙果写作网站国际时事新闻最新消息
  • flash网站整站源码免费下载网站开发方案 文档
  • 网站制作企业制作企业网站新闻列表页面网页设计
  • 沈阳网站建设找德泰诺杭州建设网站
  • 网站优化具体做哪些事情手机医疗网站建设
  • html5创意网站网站安全评估报告
  • 公司网站推广是做什么湖南响应式官网建设哪家好
  • 网页制作是建网站的第几步农村建设集团有限公司网站首页
  • 义乌网站建设托管珍岛网站模板
  • 余姚网站建设 熊掌号宁波网站制作报价
  • 广州做网站比较好的公司甘肃省和住房建设厅网站
  • 请柬网站开发cms模板网
  • 郑州网站建设廴汉狮网络企业网站的建设
  • 嘉兴网站建设wmcn网站个性化制作
  • 蓬莱专业做网站公司沪佳装修公司全部门店
  • 建设网站应该注意的地方学网站开发好不好