日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2025/4/16 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 时间同步-ntp服务器的搭建(docker版本) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

introduce

用于構建cdm所需要的ntp服務器鏡像,實現宿主機和ntpserver同步,ntpserver于ntpclient的同步

項目地址

項目github

image build

docker image build -t docker.finogeeks.club/linzhihuang/fino-cdm-ntp:v2.0

run

docker run --rm -it docker.finogeeks.club/linzhihuang/fino-cdm-ntp:v2.0

run cluster

docker compose up

config

我們通過下面的幾步來完成ntp服務端和客戶端的搭建

  • 在server的服務機器上我們通過

    volumes:- /etc/localtime:/etc/localtime:ro

    讓docker和服務器的時間保持一致

  • 在server的服務上還需要配置/etc/ntp.conf,方式如下shell

    rm /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
  • 在client的服務上對/etc/ntp/。方式如下shell

    echo "server ${NTP_SERVER_HOSTNAME} prefer" >> /etc/ntp.conf echo "restrict ${NTP_SERVER_HOSTNAME} " >> /etc/ntp.conf
  • 總結

    以上是生活随笔為你收集整理的时间同步-ntp服务器的搭建(docker版本)的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。