-
ntp 时间同步
2020-12-27 17:21:11时间同步的作用 NTP (Network Time Protocol,网络时间协议)是用来使计算机时间同步的一种协议 它可以使计算机对其服务器或时钟源做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十...时间同步的作用
- NTP (Network Time Protocol,网络时间协议)是用来使计算机时间同步的一种协议
- 它可以使计算机对其服务器或时钟源做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒)
- 对于服务器群集来说,这个是一个很重要的服务,因为群集需要保证每个服务器的时间是保持一致的,这样它们在执行同一个任务时才不会出现有的服务器有滞后的现象,这样群集的状态才是健康的。
NTP的工作模式
- C/S模式
NTP的协议及端口号
- UDP协议123号端口
配置步骤
(1)配置环境
- 服务端:20.0.0.13
- 客户端1:20.0.0.14
- 客户端2:20.0.0.15
(2)全部关闭防火墙
[root@server4 ~]# systemctl stop firewalld [root@server4 ~]# systemctl disable firewalld [root@server4 ~]# setenforce 0
(3)全部安装 ntpdate 软件
[root@server4 ~]# yum -y install ntpdate
(4)服务器端同步 aliyun 时间
[root@server4 ~]# ntpdate ntp.aliyun.com
(5)服务器端为其他客户机提供服务需要安装 ntp 软件
[root@server4 ~]# yum -y install ntp
(6)修改 ntp 配置文件
[root@server4 ~]# vi /etc/ntp.conf restrict default nomodify # 第8行 restrict 20.0.0.0 mask 255.255.255.0 nomodify notrap # 第17行,20.0.0.0 为本机上网网段 第 21 行到第 24 行删除,重新添加两行 fudge 127.127.1.0 stratum 10 server 127.127.1.0
(7)启动服务
[root@server4 ~]# systemctl start ntpd [root@server4 ~]# netstat -anptu | grep ntpd udp 0 0 20.0.0.13:123 0.0.0.0:* 78169/ntpd
(8)设置周期性计划任务
[root@server4 ~]# crontab -e * * * * * /usr/sbin/update ntp.aliyun.com
(9)客户机设定同步源为 20.0.0.13
[root@server5 ~]# ntpdate 20.0.0.13
[root@server6 ~]# ntpdate 20.0.0.13
(10)客户机设置周期性计划任务
[root@server5 ~]# crontab -e * * * * * /usr/sbin/update 20.0.0.13
[root@server6 ~]# crontab -e * * * * * /usr/sbin/update 20.0.0.13
-
简单理解时间同步和时钟同步
2019-10-16 14:00:11时钟同步和时间同步 先说一下基本概念:时钟同步是指频率同步;时间同步是指相位同步。(补充一下:相位同步的前提是频率必须同步,怕一些初入通信行业的小伙伴不太熟悉这两个概念。) 上图是频率同步(时钟同步)...时钟同步和时间同步
先说一下基本概念:时钟同步是指频率同步;时间同步是指相位同步。(补充一下:相位同步的前提是频率必须同步,怕一些初入通信行业的小伙伴不太熟悉这两个概念。)
上图是频率同步(时钟同步),可能看得不是很明白,通俗一点讲就是,信号是由0和1组成,把时间轴放大来看,就是一个个小方块,就像下图一样,时钟同步是指在相同的时间内,“方块”的数量是一样的,在下图里面,就说B和C达到了时钟同步。
而时间同步就是指相位相同,看下图中,相位就是指在频率同步的基础,两个对应的上升沿的位置,之间的差距就是相位时间差。
简析完时钟同步和时间同步的概念后,我们再来看看为什么会有时钟同步和时间同步的需求。
先说时钟同步,数据在线路中传输时是以一帧一帧传输的,如果上下游频率不一致,就很可能会出现漏读滑动,打个比方,就像上文说的,我一次发成千上万个小方块过去,时钟不同步,可能最后的或者最前面的小方块对面就没读到,就出现了数据的丢失,显然在数据传输这是不允许的。所以时钟同步是必须要的。
那么时间同步,其实时间同步主要是无线传输的需求,就像下表中,很多无线制式都对时间同步有要求,现在随着互联网的广泛发展,很多网络结构都接入传输网络中,时间同步也就成为数据传输中的一个很重要的需求。后面再来讲讲时间同步中这几年热门的1588V2协议。
-
linux时间同步、多台服务器时间同步
2019-01-17 12:15:45时间同步: 1、date -s "2015-06-08 22:08:06" // 设置系统时间。 2、配置时间服务器,集群的其他机器都跟其中一台机器同步时间。 定时任务执行时间同步的操作 时间同步服务器需要安装ntp服务 例如将...时间同步:
1、date -s "2015-06-08 22:08:06" // 设置系统时间。
2、配置时间服务器,集群的其他机器都跟其中一台机器同步时间。
定时任务执行时间同步的操作时间同步服务器需要安装ntp服务
例如将node01作为主服务器,其他节点都同步该节点的时间,在node01上执行如下操作:
1、yum list | grep ntp2、yum -y install ntp.x86_64
3、修改配置文件:
vi /etc/ntp.conf
# Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap restrict 192.168.149.0 mask 255.255.255.0 nomodify notrap #加入这一行,表示允许这个网段的ip来同步时间 # 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 #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 #先禁用4个自带的服务,添加server 127.127.1.0
客户端(需要做时间同步的机器)需要安装ntpdate
1、yum list | grep ntp2、yum -y install ntpdate.x86_64
-
Hadoop 集群时间同步
2019-03-31 13:02:16时间同步的方式: 找一个机器,作为时间服务器,所有的机器与这台集群时间进行定时 的同步,比如,每隔十分钟,同步一次时间。 时间服务器配置 必须 root 用户!!! 检查 ntp 是否安装 [root@hadoop102 hadoop]#...
时间同步的方式:
找一个机器,作为时间服务器,所有的机器与这台集群时间进行定时 的同步,比如,每隔十分钟,同步一次时间。时间服务器配置
必须 root 用户!!!
检查 ntp 是否安装
[root@hadoop102 hadoop]# rpm -qa|grep ntp ntp-4.2.6p5-10.el6.centos.x86_64 fontpackages-filesystem-1.41-1.1.el6.noarch ntpdate-4.2.6p5-10.el6.centos.x86_64
修改 ntp 配置文件
[root@hadoop102 hadoop]# vim /etc/ntp.conf # Hosts on local network are less restricted. # 允许192.168.0.0/254子网内主机时间同步 restrict 192.168.2.0 mask 255.255.255.0 nomodify notrap # 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 #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 # 从本机同步 fudge 127.127.1.0 stratum 10 # 指定阶层编号为10,降低其优先度
修改/etc/sysconfig/ntpd 文件
[root@hadoop102 hadoop]# vim /etc/sysconfig/ntpd # Drop root to id 'ntp:ntp' by default. OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g" # 增加内容如下(让硬件时间与系统时间一起同步) SYNC_HWCLOCK=yes
重新启动 ntpd
# 查看ntpd状态 [root@hadoop102 hadoop]# service ntpd status ntpd 已死,但 pid 文件仍存 [root@hadoop102 hadoop]# service ntpd start 正在启动 ntpd: [确定] [root@hadoop102 hadoop]# service ntpd status ntpd (pid 3506) 正在运行... # 设置开机启动 [root@hadoop102 hadoop]# chkconfig ntpd on
其他机器配置
必须 root 用户!!!
[root@hadoop103 hadoop]# crontab -e * * * * * /usr/sbin/ntpdate hadoop102 #hadoop104同上
测试
[root@hadoop103 hadoop]# date 2019年 03月 31日 星期日 00:50:23 CST [root@hadoop103 hadoop]# date -s "2017-9-11 11:11:11" 2017年 09月 11日 星期一 11:11:11 CST [root@hadoop103 hadoop]# date 2017年 09月 11日 星期一 11:11:12 CST [root@hadoop103 hadoop]# date 2017年 09月 11日 星期一 11:11:42 CST [root@hadoop103 hadoop]# date 2019年 03月 31日 星期日 00:51:18 CST [root@hadoop103 hadoop]#
同步网络时间
[root@hadoop102 hadoop]# service ntpd stop 关闭 ntpd: [确定] [root@hadoop102 hadoop]# /usr/sbin/ntpdate 0.cn.pool.ntp.org && /sbin/hwclock -w 31 Mar 12:59:23 ntpdate[3566]: step time server 78.46.102.180 offset 43393.687845 sec [root@hadoop102 hadoop]# date 2019年 03月 31日 星期日 12:59:26 CST [root@hadoop102 hadoop]# service ntpd start 正在启动 ntpd: [确定] [root@hadoop102 hadoop]# chkconfig ntpd on [root@hadoop102 hadoop]# date 2019年 03月 31日 星期日 13:00:09 CST [root@hadoop102 hadoop]#
-
虚拟机时间同步
2019-09-17 21:40:071.与阿里云时间同步 (1)安装ntp服务 yum list | grep ntp yum install -y ntp.x86_64 (2)时间服务器 ntpdate ntpl.aliyun.com 2.集群内时间同步 (1)配置时间服务器,集群的其他机器都跟hadoop05所在机器同步... -
Linux配置NTP时间同步
2018-04-13 14:46:41一:NTP是网络时间同步协议,就是用来同步网络中各个计算机的时间的协议。二:NTP服务端配置1.检查系统是否安装了NTP包(linux系统一般自带NTP4.2),没有安装我们直接使用yum命令在线安装: yum install ntp2.NTP... -
NTP时间同步
2019-04-20 16:55:42(1)客户端将采用随机端口向NTP服务器发出时间同步请求 (2)NTP服务器收到请求后会发出调校时间 (3)NTP客户端收到NTP服务器的消息后,进行调整、完成同步 同步服务器时间的方式 1.一次性同步 2.通过服务自动同步... -
服务器时间同步
2019-01-01 13:30:28用ntp来做时间同步,它会到时间服务器里去同步时间,保证了时间的准确度。 安装ntp服务:yum install ntpdate -y 时间同步命令:ntpdate cn.ntp.org.cn 该命令表示为:到域名为cn.ntp.org.cn的时间服务器上同步... -
ntp时间服务器 时间同步
2017-10-15 11:05:302.本地服务器较多,在本地设置时间同步服务器, 时间同步的两个命令 ntpd : 校准时间,一点点的校准过来时间的,最终把时间慢慢的校正对。 ntpd服务可以在修正时间的同时,修正cpu tick -
CentOS7 时间与网络时间同步
2019-04-29 15:18:12今天分享一下Centos下如何将本地集群时间和网络时间同步,这样妈妈再也不用担心我因为时间不一致而出现的失败情况。 问题描述:使用date命令查看之后,发现时间与本地时间不一致。 三步解决方法: 1、安装... -
Linux时间同步
2018-01-06 21:01:48有几种方式可以做时间同步的: date命令: date :查看当前时间,结果如下: [root@cdh3 ~]# date Sat Jan 6 20:52:09 CST 2018 date -s 20:50:09 :设置当前时间,结果如下: [root@cdh3 ~] -
NTP 时间同步
2019-03-28 09:50:34Linux服务器运行久时,系统时间就会存在一定的误差,一般情况下可以使用date命令进行时间设置,但在做数据库集群分片等操作时对多台机器的时间差是有要求的,此时就需要使用ntpdate进行时间同步。 第一种情况:连的... -
centos7 chrony配置了时间同步但是时间不同步的问题
2019-08-07 10:59:32今天发现之前配置了chrony时间同步,但是发现时间同步客户端机器跟时间同步服务器端的时间并不同步。 查客户端: manage@k8s-master1[/home/manage]$timedatectl Local time: 三 2019-08-07 10:03:33 CST ... -
hadoop 集群时间同步
2019-10-24 09:51:46集群时间同步 时间同步的方式:找一个机器,作为时间服务器,所有的机器与这台集群时间进行定时的同步,比如,每隔十分钟,同步一次时间。 分析 hadoop102 为主节点 hadoop103、hadoop104为分节点 配置时间同步具体... -
Python 时间同步程序
2019-08-23 11:10:30Python程序时间同步 局域网内利用另一台电脑穿越代理,与互联网时间同步 -
chronyd 时间同步
2019-05-10 18:15:13chronyd 时间同步 chrony 服务器 yum -y install chrony cp /etc/chrony.conf{,.bak} #备份默认配置 cat > /etc/chrony.conf << EOF ##外部NTP服务器 server ntp6.aliyun.com iburst server ... -
Linux 时间同步ntpdate
2018-09-19 09:25:18Linux网络时间同步 2.解决办法 2.1安装ntpdate 完成时间同步 # yum install ntpdate -y 2.2手工同步网络时间,执行以下命令,将从time.nist.gov同步时间 # ntpdate 0.asia.pool.ntp.org 若上面的时间服务器... -
硬件时间和系统时间同步命令
2019-09-25 05:25:13问题一:时间不同步 执行命令:clock --hctosys 硬件时间和系统时间同步命令 -
集群时间同步的配置
2017-11-14 12:35:35集群时间同步 时间同步的方式:找一个机器,作为时间服务器,所有的机器与这台集群时间进行定时的同步,比如,每日十分钟,同步一次时间。 配置时间同步: 1)时间服务器配置 (1)检查ntp是否安装 [root@... -
linux 时间同步命令
2019-08-09 16:28:41若要和Internet时间同步,使用ntpdate -u time.nist.gov同步网络时间 说明服务器还没有安装ntpdate,我们使用yum install ntpdate -y 进行安装即可 最后再使用 ntpdate - u time.nist.gov同步网络时间 ... -
linux 时间同步和时间设置
2018-05-08 16:40:06时间同步 Linux下使用ntpdate时间同步。首先确认已安装ntpdate,或者在联网环境下安装; yum install -y ntpdate ntpdate命令,网络时间同步命令 ntpdate -u 210.72.145.44 注意:若不加上-u参数, 会出现以下提示... -
集群时间同步
2017-10-01 09:45:01集群时间同步:在集群中找一台机器(node1,这里的node1就是任意一台机器,也可以写对应的IP地址),然后集群中的其他机器与node1 每十分钟同步一次。 步骤: 1.rpm -qa | grep ntp 查看ntp 和ntpdate 是否安装 [root@... -
C#与NTP服务端时间同步(客户端与服务端时间同步问题)
2019-05-05 14:53:00很多种业务需求,要客户端与服务端的时间同步,比如在交易状态,需要验证客户端与服务端的时间,比如集群,比如记录文件安全 、审查和监控,文件时间戳,存取安全与确认等等,总之用处多多 NTP时间服务器 NTP时间... -
Windows 时间同步出错
2018-07-24 10:00:58在Windows下同步网络时间时出现下面的错误 解决方案: 在服务器一栏填写上:cn.pool.ntp.org,然后再点击立即更新 这样就完成时间同步了。 -
VMware禁用时间同步
2018-02-11 15:19:00完全禁用时间同步 参考文档:http://pubs.vmware.com/vsphere-50/index.jsp#com.vmware.vmtools.install.doc/GUID-678DF43E-5B20-41A6-B252-F2E13D1C1C49.html 即使未打开周期性时间同步,虚拟机有时也会与主机... -
WIN10 时间同步
2019-04-09 14:06:50最近研究了下WIN10 下的时间同步,供有需要的参考。 1、点击任务栏右下角的时间,然后点击调整日期/时间。 2、日期和时间窗口中,我们这时候选择下方这里的添加不同时区的时钟。 3、日期和时间中选择...
-
21年新接口自动化测试视频postman教程 零基础接口测试
-
PHP+Mysql 实现留言板
-
Macbook M1 安装node(亲测)
-
阿里云云计算ACP考试必备教程
-
Java星选一卡通
-
Laya 2.0 开发3D小游戏 入门教学
-
soul网关案例学习:http代理大致流程
-
思科Cisco全部路由器镜像文件免费下载.zip
-
专利预警与技术创新(PDF)
-
回流重绘方向的性能优化
-
CentOS 8 安装配置JDK 15.0.1
-
【数据分析-随到随学】Mysql数据库
-
hadoop自动化运维工具Ambari应用实践
-
数据类型转换、运算符、方法入门
-
第1章 Java入门基础及环境搭建【java编程进阶】
-
浙大版《数据结构(第2版)》题目集习题3.10 汉诺塔的非递归实现 (25分)
-
Unity游戏开发之数字华容道
-
flutter插件调用APP页面、使用原生aar,framework库
-
单元测试UnitTest+Pytest【Selenium3】
-
(新)备战2021软考网络工程师培训学习套餐