Centos設定時區和同步系統時鐘
1、通過timedatectl命設定所屬時區
timedatectl命令用法如下
# timedatectl --help
timedatectl [OPTIONS...] COMMAND ...
Query or change system time and date settings.
-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
Commands:
status Show current time settings(檢視時間時區資訊)
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 Control whether NTP is enabled(開啟NTP時鐘同步)
# 設定伺服器時區為上海時區
# timedatectl set-timezone Asia/Shanghai
# 檢視設定結果
# timedatectl status
# 檢視時間
# date
2、通過chryon開啟時鐘同步
chryon分為Server和Client兩種,Client向Server發起同步
修改/etc/chrony.conf配置檔案
server ntp.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp.aliyun.com minpoll 4 maxpoll 10 iburst
server ntp1.aliyun.com minpoll 4 maxpoll 10 iburst
server ntp1.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp10.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp11.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp12.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp2.aliyun.com minpoll 4 maxpoll 10 iburst
server ntp2.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp3.aliyun.com minpoll 4 maxpoll 10 iburst
server ntp3.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp4.aliyun.com minpoll 4 maxpoll 10 iburst
server ntp4.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp5.aliyun.com minpoll 4 maxpoll 10 iburst
server ntp5.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp6.aliyun.com minpoll 4 maxpoll 10 iburst
server ntp6.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp7.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp8.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
server ntp9.cloud.aliyuncs.com minpoll 4 maxpoll 10 iburst
然後重啟chronyd服務
# systemctl restart chronyd
# systemctl status chronyd
檢測chronyd是否生效
# chronyc sources
# chronyc sourcestats
「其他文章」
- Keycloak中OIDC端點(URL)介紹
- Keycloak中OIDC端點(介面)介紹
- Keycloak搭建域模式叢集(Domain Mode Cluster)
- Centos搭建KNIME Analytics Platform
- Centos7安裝tigervnc-server並配置開機自啟動
- Centos設定時區和同步系統時鐘
- Centos設定時區和同步系統時鐘
- Keycloak關係資料庫配置
- Keycloak關係資料庫配置
- Keycloak設定中文控制檯
- Keycloak工作模式
- Keycloak安裝環境說明
- Centos Keycloak部署(單臺伺服器)
- Zookeeper四字命令
- Zookeeper資料模型Znode簡介
- Zookeeper配置引數說明
- Zookeeper工具集詳解
- Zookeeper 叢集搭建(Centos版)
- 高效能負載均衡設計與實現
- Windows Server設定Nginx開機自啟動