2019独角兽企业重金招聘Python工程师标准>>>

往往在比较正规的公司里,hadoop集群是不对外的。而比如kudu等组件中,对时间同步要求比较严格。本文旨在在内网中以一台服务器为ntp server,其他节点与之同步的步骤。

本文使用ntp 提供对时服务。


# 查看对时同步状态
ntpstat # 安装 ntp,不过一般默认都安装了。
yum install ntp# 开机启动
chkconfig ntpd on

node1 192.168.1.100 node2 192.168.1.101 假设 node1 为 node2 提供对时服务。

node1 编辑 /etc/ntp.conf 文件


driftfile /var/lib/ntp/driftrestrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1# Hosts on local network are less restricted.
# 允许内网其他机器同步时间
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap# Use public servers from the pool.ntp.org project.
# 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cnserver asia.pool.ntp.org perfer   server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.orgrestrict asia.pool.ntp.org nomodify notrap noquery# 外部时间服务器不可用时,以本地时间作为时间服务
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10includefile /etc/ntp/crypto/pwkeys /etc/ntp/keys

编辑完之后,启动ntp服务

service ntpd start

node2 编辑 /etc/ntp.conf 文件

driftfile /var/lib/ntp/drift
restrict 127.0.0.1
restrict -6 ::1# 配置时间服务器为本地的时间服务器
server 192.168.1.100restrict 192.168.1.100 nomodify notrap noqueryserver  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10includefile /etc/ntp/crypto/pwkeys /etc/ntp/keys

# 先同步一下,以便平滑同步到一直所需时间尽量短。
ntpdate -u 192.168.1.100# 启动对时服务
service ntpd start# 开机启动
chkconfig ntpd on# 查看对时状态
ntpstat 
# 在node1 192.168.1.100 上定时同步:
crontab -e
*/5 * * * * /usr/sbin/ntpdate 210.72.145.44 >/dev/null 2>&1

参考

转载于:https://my.oschina.net/corleone/blog/855900

内网对时服务 ntp 平滑更改相关推荐

  1. 阿里云内网和公共NTP服务器(网络时间协议-时间同步服务)

    关键字:阿里云内网和公共NTP服务器(网络时间协议-时间同步服务) 一.简介: NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议. 在计算机 ...

  2. 详细教你用NPS搭建内网穿透服务,外出时轻薄本轻松连接家里的游戏主机远程玩耍

    文章目录 前言 一.NPS概述 NPS的原理 二.NPS服务器搭建 1.下载软件 2.云服务器配置 2.1.防火墙配置 2.2.用WinSCP远程上传服务文件 2.3.使用SSH终端安装启动 2.4. ...

  3. frp内网穿透服务搭建

    GitHub - fatedier/frp: A fast reverse proxy to help you expose a local server behind a NAT or firewa ...

  4. ubuntu 局域网dns服务器_如何在 Ubuntu 16.04 服务器上配置内网 DNS 服务

    DNS 1. 简介 本文使用 BIND9,用尽量少的步骤,搭建出一个可用的内网 DNS 服务.另外要说明的一点是,本文不仅适用于 Ubuntu 16.04,也使用其后的 Ubuntu 系统(截止到目前 ...

  5. frp + nginx 配置多人共用的http 内网穿透服务

    frp + nginx 配置多人共用的http 内网穿透服务 一. 前言 frp 是一个用Go语言开发的,可用于内网穿透的高性能的反向代理应用,支持 tcp, udp . http 和 https.可 ...

  6. Mac 系统部署Frp内网穿透服务 实现frpc shell启动脚本启动、停止

    Mac 系统部署Frp内网穿透服务 实现frpc shell启动脚本启动.停止 前言 最近疫情导致居家办公,而工作中需要用到公网地址便于调试,于是就在本机(Mac系统)配置了Frpc内网穿透. 本来想 ...

  7. frps 多个_同时穿透多个内网web服务,提示冲突

    What version of frp are you using (./frpc -v or ./frps -v)? 0.27.1 What operating system and process ...

  8. NPS内网穿透服务端一键安装脚本

    NPS内网穿透服务端一键安装脚本,支持安装,更新,卸载以及重新生成配置文件,基于官方GitHub制作,自动安装最新版本 作者博客链接 脚本概览 安装 wget https://content.928w ...

  9. 手把手教你,搭建内网穿透服务

    我的 GitHub 仓库:? 手把手教你搭建内网穿透服务,基于 lanproxy 穿透服务,为你深度定制了开箱即用的服务端和客户端 Docker 镜像. 在很多场景下内网穿透都是我们常常遇到的需求,之 ...

最新文章

  1. 这些行业,将率先落地AI芯片 | 星前沿
  2. 微信小程序 - 实现购物车结算
  3. LuoguP4606 [SDOI2018]战略游戏
  4. visudo精确用户赋权(sudo)
  5. node-sass 安装失败 win32-x64-57_binding.node
  6. JavaScript - 测试 jQuery
  7. Unity3d 镜面反射 vertex and frag Shader源代码
  8. Spark的简介和在大数据领域的地位
  9. 3dmax电脑配置要求(3dmax需要什么样的笔记本配置?)
  10. 树莓派linux led字符设备驱动(互斥)
  11. 缺失值的处理方法大总结
  12. 【机器学习】损失函数MAE
  13. 班级网站的设计与实现
  14. 生存分析及生存曲线_2021-01-30
  15. 考拉解析公众号Android手机如何保存视频到相册
  16. Matplotlib坐标轴范围
  17. android 斜边_android自定义控件之中间是斜线的占比条
  18. php ses 发送邮件,php – 无法使用Amazon SES发送电子邮件
  19. 应用层(计网_06)
  20. 十八、商城 - 规格管理-模板管理(6)

热门文章

  1. “干掉” Date,Java8 LocalDate 真香!
  2. 讲讲 Redis 缓存更新一致性
  3. 试试 IntelliJ IDEA 自带的高能神器!
  4. 有 Bug 不会调试 ? 这篇文章很详细 !
  5. 万字长文带你了解推荐系统全貌!
  6. 大厂白嫖拖垮开源!开源届码农:用户脾气大需求多还不给钱
  7. 辞去美国终身教职回国的帅教授,拟增列为顶尖985大学博导
  8. MIT最新报告:完全无人驾驶仍需10年,马斯克:特斯拉已经实现
  9. Django博客系统(首页用户名展示)
  10. 逻辑回归之案例:癌症分类预测-良/恶性乳腺癌肿瘤预测