zoukankan      html  css  js  c++  java
  • 大数据高可用集群环境安装与配置(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/

  • 相关阅读:
    023 使用@Value注解完成配置信息的注入
    022 使用@Bean的属性完成初始化和销毁的指定
    021 使用@Import注解完成Bean的注册
    020 使用@Conditional注解完成条件注入
    019 使用@Lazy完成懒加载
    018 使用@Scope完成bean的作用域的声明
    017 包扫描器和标记注解
    016 @Configuration和@Bean
    015 spel
    vs2010编辑器中找不到System.Web.Extensions.dll
  • 原文地址:https://www.cnblogs.com/EmptyFS/p/12113089.html
Copyright © 2011-2022 走看看