前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >时间同步-ntp服务器的搭建(docker版本)

时间同步-ntp服务器的搭建(docker版本)

原创
作者头像
osenlin
修改2018-06-07 15:32:02
5.6K2
修改2018-06-07 15:32:02
举报
文章被收录于专栏:数据架构之路数据架构之路

introduce

用于构建cdm所需要的ntp服务器镜像,实现宿主机和ntpserver同步,ntpserver于ntpclient的同步

项目地址

项目github

image build

代码语言:txt
复制
docker image build -t docker.finogeeks.club/linzhihuang/fino-cdm-ntp:v2.0

run

代码语言:txt
复制
docker run   --rm -it docker.finogeeks.club/linzhihuang/fino-cdm-ntp:v2.0

run cluster

代码语言:txt
复制
docker compose up

config

我们通过下面的几步来完成ntp服务端和客户端的搭建

  1. 在server的服务机器上我们通过volumes: - /etc/localtime:/etc/localtime:ro 让docker和服务器的时间保持一致
  2. 在server的服务上还需要配置/etc/ntp.conf,方式如下shellrm /etc/ntp.conf cat >> /etc/ntp.conf <<EOF # 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org # allow update time by the upper server restrict 0.cn.pool.ntp.org nomodify notrap noquery restrict 0.asia.pool.ntp.org nomodify notrap noquery restrict 3.asia.pool.ntp.org nomodify notrap noquery # Undisciplined Local Clock. This is a fake driver intended for backup # and when no outside source of synchronized time is available. # 外部时间服务器不可用时,以本地时间作为时间服务 server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 EOF
  3. 在client的服务上对/etc/ntp/。方式如下shellecho "server ${NTP_SERVER_HOSTNAME} prefer" >> /etc/ntp.conf echo "restrict ${NTP_SERVER_HOSTNAME} " >> /etc/ntp.conf

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • introduce
  • 项目地址
  • image build
  • run
  • run cluster
    • config
    相关产品与服务
    容器镜像服务
    容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档