linux时间同步服务(chronyd服务) 您所在的位置:网站首页 linux查询服务器时间命令是什么 linux时间同步服务(chronyd服务)

linux时间同步服务(chronyd服务)

2024-07-05 05:20| 来源: 网络整理| 查看: 265

配置chrony服务

集群中节点之间需要时间同步,不依赖外部的时间服务NTP,在内部搭建时间服务器。首先保证所有节点都安装了chrony,命令如下:yum install chrony -y。 在提供时间同步服务的服务端节点做如下操作:

vim /etc/chrony.conf 22 allow 192.168.211.131 ##允许哪些客户端来同步主机的时间 29 local stratum 10 ##本机不同步任何主机时间,本机作为时间源 systemctl restart chronyd.service ##重启配置文件

在这里插入图片描述 在需要同步服务的客户端节点做如下操作:

vim /etc/chrony.conf 3 server 192.168.211.132 iburst ##本机同步192.168.211.132主机的时间 systemctl restart chronyd.service ##重启配置文件

在这里插入图片描述 测试:在客户端节点执行chronyc sources -v 在这里插入图片描述

一些系统时间设定的命令 date ##可用man date 学习date命令 NAME date - print or set the system date and time SYNOPSIS date [OPTION]… [+FORMAT] date [-u|–utc|–universal] [MMDDhhmm[[CC]YY][.ss]] DESCRIPTION Display the current time in the given FORMAT, or set the system date. Mandatory arguments to long options are mandatory for short options too.

#查看当前日期的x天前或者x天后的时间 在这里插入图片描述 1.从1970年1月1日 00:00:00 到目前为止经历的秒数 2.12 PM/AM 3.一年中的第几周 在这里插入图片描述

timedatectl status ##显示系统时间 timedatectl set-timezone Asia/Shanghai ##更改当前时区为东八区 timedatectl set-time “2012-10-30 18:17:16” ##设定系统时间 timedatectl set-local-rtc 0 ##设定是否使用UTC时间

在这里插入图片描述



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有