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


    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/

  • 相关阅读:
    解决html中刷新页面后checkbox还选中的问题
    初始化spring容器的几种方法
    在web.xml中配置spring配置文件的路径
    查找算法
    排序算法
    ORACLE TO_CHAR,TO_DATE函数格式说明
    ORACLE TO_DATE函数
    ORACLE SUBSTR函数
    ORACLE学习笔记
    Linux 查看端口占用情况
  • 原文地址:https://www.cnblogs.com/EmptyFS/p/12113089.html
Copyright © 2020-2023  润新知