当前位置:网站首页>搭建ntp时间服务器(安装sql2000配置服务器失败)
搭建ntp时间服务器(安装sql2000配置服务器失败)
2022-08-01 14:06:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
简介
时间服务NTP:Network Time Protocol 作用:用来给其他主机提供时间同步服务,在搭建服务器集群的时候,需要保证各个节点的时间是一致的,时间服务器不失为一个好的选择。
准备工作
- 关闭防火墙、关闭selinux
- 系统版本:CentOS7.x,
- NTP服务器IP:10.220.5.111,客户端IP:10.220.5.179
安装配置NTP服务器端
一、安装ntp
[[email protected] ~]# yum install ntp -y二、修改ntp的配置文件
[[email protected] ~]# cp /etc/ntp.conf{,.bak}
[[email protected] ~]# vim /etc/ntp.conf
server 127.127.1.0 #以本机作为时间服务器
fudge 127.127.1.0 startnum 10 #设置服务器层级
restrict 127.0.0.1 # 允许本机使用这个时间服务器
restrict 10.220.5.0 netmask 255.255.255.0 #允许允许10.220.5.0/24网段的所有主机使用该时间服务器进行时间同步
driftfile /var/lib/ntp/ #记录当前时间服务器,与上游服务器的时间差的文件
logfile /var/log/ntp/ntp.log #指定日志文件位置,需要手动创建三、创建日志文件
[email protected] ~]# mkdir /var/lib/ntp/
[[email protected] ~]# touch /var/lib/ntp/ntp.log三、启动服务
[[email protected] ~]# systemctl start ntpd
[[email protected] ~]# systemctl enable ntpd四、查看状态
[[email protected] ~]# ntpstat
synchronised to local net at stratum 6
time correct to within 11 ms
polling server every 64 s
#synchronised:表示时间同步完成(ntp可以正常工作了)
#unsynchronised:表示时间同步尚未完成
# 或者用 ntpq -p查看状态
[[email protected] ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 5 l 13 64 377 0.000 0.000 0.000安装配置NTP客户端
一、安装
[[email protected] ~]# yum install ntp ntpdate -y二、修改配置文件
[[email protected] ~]# cp /etc/ntp.conf{,.bak}
[[email protected] ~]# vim /etc/ntp.conf
server 10.220.5.111 #设置以10.220.5.111做为本机的时间服务器
restrict 127.0.0.1
logfile /var/log/ntp/ntp.log #指定日志文件位置,需要手动创建三、创建日志文件
[[email protected] ~]# mkdir /var/log/ntp
[[email protected] ~]# touch /var/log/ntp/ntp.log四、先执行一次ntpdate时间同步
[[email protected] ~]# ntpdate 10.220.5.111五、启动ntpd
[[email protected] ~]# systemctl start ntpd六、检查状态
[[email protected] ~]# ntpstat
unsynchronised
time server re-starting
polling server every 8 s
# 或者
[[email protected] ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
10.220.5.111 LOCAL(0) 6 u 11 64 1 0.502 0.009 0.000说明:在工作中我们一般都是使用ntpdate+ntp来完成时间同步,因为单独使用ntpdate同步时间虽然简单快捷但是会导致时间不连续,而时间不连续在数据库业务中影响是很大的,单独使用ntp做时间同步时,当服务器与时间服务器相差大的时候则无法启动ntpd来同步时间。由于ntpd做时间同步时是做的顺滑同步(可以简单理解为时间走得快,以便将落后的时间赶过来),所以同步到时间服务器的的时间不是瞬间完成的,开启ntpd之后稍等三五分钟就能完成时间同步。
补充:用ntpq -p查看状态时的各种参数解释
参数 | 释义 |
|---|---|
remote | 上游的时间服务器的ip或者主机名,如果是*表示本机就是做为上游服务器工作 |
refid | “.LOCL.”表示基于当前主机提供时间同步服务,如果是IP地址表示基于一个上游服务器提供时间同步服务。 |
st | 表示remote远程服务器的层级编号 |
t | |
when | 表示几秒之前做过一次时间同步 |
poll | 表示每隔多少秒做一次时间同步 |
reach | 表示向上游服务器成功请求时间同步的次数 |
delay | 从本地机发送同步要求到ntp服务器的时间延迟 |
offset | 主机通过NTP时钟同步与所同步时间源的时间偏移量,单位为毫秒(ms)。offset越接近于0,主机和ntp服务器的时间越接近 |
jitter | 这是一个用来做统计的值. 它统计了在特定个连续的连接数里offset的分布情况. 简单地说这个数值的绝对值越小,主机的时间就越精确 |
——做运维之前很矫情的小年轻—–
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/126413.html原文链接:https://javaforall.cn
边栏推荐
- win10+Qt5.15.2 realizes low-power bluetooth control
- NebulaGraph v3.2.0 Performance Report
- 有谁知道pg12.5版本的数据库驱动在哪里能找到么?
- Programmer's Romantic Tanabata
- A Beginner's Guide to Performance Testing
- D - Draw Your Cards (Simulation)
- 珠海首个水环境安全监测系统上线
- 热心肠:关于肠道菌群和益生菌的10个观点
- 搭建LNMT架构
- Performance Optimization - Animation Optimization Notes
猜你喜欢

HTB-Mirai

透过开发抽奖小程序,体会创新与迭代

MCU开发是什么?国内MCU产业现状如何

透过现象看本质,如何针对用户做好需求分析

AD单片机九齐单片机NY8B062D SOP16九齐

HTB-Shocker

微信UI在线聊天源码 聊天系统PHP采用 PHP 编写的聊天软件,简直就是一个完整的迷你版微信

ECCV 2022|R2L: 用数据蒸馏加速NeRF

Longkou united chemical registration: through 550 million revenue xiu-mei li control 92.5% stake

论文笔记All about Eve: Execute-Verify Replication for Multi-Core Servers
随机推荐
What is a closure?
我寻找的方向
大神们,ODPS用的是MySQL吗?
微信UI在线聊天源码 聊天系统PHP采用 PHP 编写的聊天软件,简直就是一个完整的迷你版微信
PAT 1162 Postfix Expression(25)
sql中常用到的正则表达
Performance Optimization - Resource Optimization Notes
经纬信息IPO过会:年营收3.5亿 叶肖华控制46.3%股权
Batch replace tables in Word with pictures and save
【无标题】
iPhone难卖,被欧洲反垄断的服务业务也难赚钱了,苹果的日子艰难
Qt实战案例(55)——利用QDir删除选定文件目录下的空文件夹
ABC260 E - At Least One(双指针)
Typora报错:This beta version of Typora is expired
灵魂发问:MySQL是如何解决幻读的?
Amperon IPO meeting: annual revenue of 500 million Tongchuang Weiye and China Mobile Innovation are shareholders
透过现象看本质,如何针对用户做好需求分析
[深入研究4G/5G/6G专题-47]: 5G Link Adaption链路自适应-3-下行链路自适应DLLA-PDSCH信道
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
超全!全国近90所大学考研报录比汇总!