查看: 82|回覆: 0

CentOS 7配置NTP客户端

[複製鏈接]

3

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2011-1-27
發表於 2020-7-12 00:16:00 | 顯示全部樓層 |閲讀模式

保持服务器时间准确,对于业务系统的运行、数据库中时间的记录等至关重要。通常的做法是为服务器配置NTP客户端服务,让服务器自己定时去与NTP服务器同步时间。

以CentOS 7服务器为例,为期配置NTP客户端的具体步骤如下:

一、查看本机时间,确定NTP服务器的可用性(本例中以东北大学NTP服务器ntp.neu.edu.cn为例)

# date       //查看本机时间
# ntpdate ntp.neu.edu.cn  //确认NTP服务器的可用性

 

二、配置NTP客户端

编辑ntp.conf文件,为NTP客户端配置NTP服务器的地址ntp.neu.edu.cn

// 编辑NTP配置文件
# vim /etc/ntp.conf

// 注释配置文件中原有的NTP服务器,并在其中添加自己所需的NTP服务器地址
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
server ntp.neu.edu.cn iburst

  

三、将NTP配置为(自启动)服务,并启动运行

# systemctl enable ntpd.service  //安装为服务
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

# systemctl start ntpd  //启动运行

  

四、检查NTP客户端运行状态

# systemctl status ntpd

  

 

# ntpstat

 

# watch ntpq -p

ctrl+c 退出NTP监视器

 

# ntpdate ntp.neu.edu.cn
12 Jul 00:14:46 ntpdate[19640]: the NTP socket is in use, exiting //提示NTP socket已经被使用

  

 



来源:https://www.cnblogs.com/yangjisen/p/13286278.html
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部