本文作者:丁辉
NTP时间同步
| 节点名称 | IP | 
|---|---|
| ntp-master(NTP服务器) | 192.168.1.100 | 
| node-1 | 192.168.1.10 | 
| node-2 | 192.168.1.20 | 
| node-3 | 192.168.1.30 | 
基础环境配置
安装 ntp 服务
- Centos - 1 - yum -y install ntp 
- Ubuntu - 1 - apt -y install ntp 
NTP服务器配置
- 修改配置文件 - 1 
 2- cp /etc/ntp.conf /etc/ntp.conf.bak 
 vi /etc/ntp.conf- 修改配置文件内容如下 - 1 
 2
 3
 4
 5- ##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 127.127.1.0- 填写 127.127.1.0 是一个特殊的IP地址, 代表本地主机(即自己) 或 填写其他授时中心服务器地址 
- 启动 ntpd 服务 - 1 
 2- systemctl enable ntpd 
 systemctl start ntpd
其他节点同步 NTP 服务器时间
- 修改配置文件 - 1 
 2- cp /etc/ntp.conf /etc/ntp.conf.bak 
 vi /etc/ntp.conf- 修改配置文件内容如下 - 1 
 2
 3
 4
 5- ##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 192.168.1.100- 192.168.1.100 为 NTP 服务器 IP 地址 
- 启动 ntpd 服务 - 1 
 2- systemctl enable ntpd 
 systemctl start ntpd
- 启动 ntpd 服务 - 1 
 2- systemctl enable ntpd 
 systemctl start ntpd
- 查看状态 - 1 - ntpq -p 
I'm so cute. Please give me money.
- 本文链接: https://blog.offends.cn/Linux/Docs/NTP时间同步.html
- 版权声明: 本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。
 
    
    
         
    
    
    
     
                     
                    