码迷,mamicode.com
首页 > 其他好文 > 详细

大数据高可用集群环境安装与配置(02)——配置ntp服务

时间:2019-12-28 22:51:35      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:network   crontab   高可用   rest   install   rap   yum   根据   odi   

NTP服务概述

NTP服务器【Network Time Protocol(NTP)】是用来使计算机时间同步化的一种协议,它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒),且可介由加密确认的方式来防止恶毒的协议攻击。时间按NTP服务器的等级传播。按照离外部UTC源的远近把所有服务器归入不同的Stratum(层)中。

安装部署

执行命令,安装ntp和ntpdate软件包

yum install ntp -y

 

配置NTP服务器端

vi /etc/ntp.conf

修改下面内容(没有的就添加,有的就修改):

restrict default ignore
restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap
#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
fudge 127.127.1.0 stratum 10

 

PS:在配置中,192.168.10.0 这个是当前服务器所在IP段地址,你需要根据自己服务器的IP段进行修改,它将会开放可访问当前ntp服务器的地址段

启动ntp服务

systemctl start ntpd.service
systemctl enable ntpd.service

 

配置客户端服务器

vi /etc/ntp.conf

将server注释掉,并添加master主机为服务器节点

#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 master

将同步的系统时间写入到硬件(BIOS)时间里

vi /etc/sysconfig/ntpd

在里面添加

SYNC_HWCLOCK=yes

测试是否可以连主ntp服务

ntpdate -u master

在定时器中添加自动同步设置

vi /etc/crontab

添加下面命令

0 * * * * root /usr/sbin/ntpdate -u master

 

版权声明:本文原创发表于 博客园,作者为 AllEmpty 本文欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则视为侵权。

作者博客:http://www.cnblogs.com/EmptyFS/

大数据高可用集群环境安装与配置(02)——配置ntp服务

标签:network   crontab   高可用   rest   install   rap   yum   根据   odi   

原文地址:https://www.cnblogs.com/EmptyFS/p/12113089.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!