栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

ubuntu 安装和搭建 ntp server 以及 ntp 时间同步的操作

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ubuntu 安装和搭建 ntp server 以及 ntp 时间同步的操作

ntp server 的搭建和配置见 https://www.cnblogs.com/30go/p/11231110.html
客户端同步时间的操作见:https://cloud.tencent.com/developer/article/1832436
https://www.farland.vip/2021/01/26/ubuntu-change-timezone-ntp-server/

使用 timedatectl 的操作如下:

timedatectl --help
timedatectl [OPTIONS...] COMMAND ...

Query or change system time and date settings.

Commands:
  status                   Show current time settings
  show                     Show properties of systemd-timedated
  set-time TIME            Set system time
  set-timezone ZONE        Set system time zone
  list-timezones           Show known time zones
  set-local-rtc BOOL       Control whether RTC is in local time
  set-ntp BOOL             Enable or disable network time synchronization

systemd-timesyncd Commands:
  timesync-status          Show status of systemd-timesyncd
  show-timesync            Show properties of systemd-timesyncd

Options:
  -h --help                Show this help message
     --version             Show package version
     --no-pager            Do not pipe output into a pager
     --no-ask-password     Do not prompt for password
  -H --host=[USER@]HOST    Operate on remote host
  -M --machine=ConTAINER   Operate on local container
     --adjust-system-clock Adjust system clock when changing local RTC mode
     --monitor             Monitor status of systemd-timesyncd
  -p --property=NAME       Show only properties by this name
  -a --all                 Show all properties, including empty ones
     --value               When showing properties, only print the value

See the timedatectl(1) man page for details.

关闭时间同步服务的操作: timedatectl set-ntp false,打开时间同步服务的操作:timedatectl set-ntp true,具体的执行结果可以通过 timedatectl status 查看

配置文件 /etc/systemd/timesyncd.conf 中的下列两个配置表示轮询的最低时间和轮询的最大时间,单位 秒,测试证明两者设置为同一个值也可以工作

# 表时 ntp 服务的 ip
#NTP=192.168.1.2
#轮询的最小时间间隔
#PollIntervalMinSec=32
#轮询的最大时间间隔
#PollIntervalMaxSec=2048
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/680525.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号