zoukankan      html  css  js  c++  java
  • ntp服务

    ntp服务主要是用于对计算机的时间同步管理操作。时间是对服务器来说是很重要的,一般很多网站都需要读取服务器时间来记录相关信息,如果时间不准,则可能造成很大的影响,对于集群,也需要时间同步。

    部署安装NTP服务器

    第一步:安装服务

    [root@ken ~]# yum install ntp -y

    第二步:配置NTP文件

    [root@ken ~]# vim /etc/ntp.conf
      server 127.127.1.0                        #本地时钟地址,以本机作为时间服务器,也可以根据需要选择阿里时间服务器
      restrict 127.0.0.1                        #允许本机使用时间服务器
      restrict 172.20.10.7 mask 255.255.255.240  #允许172.20.10.7使用本机的时间服务器

    第三步:重启NTP服务

    [root@ken ~]# systemctl restart ntpd

    第四步:检查NTP状态

    [root@ken ~]# ntpstat 
    synchronised to local net at stratum 6 
       time correct to within 7948 ms
       polling server every 64 s

    第五步:客户端下载NTP客户端程序

    [root@host1 ~]# yum install ntpdate -y

    第六步:客户端进行同步

    当前服务端时间

    [root@ken ~]# date
    Thu Feb 28 12:22:41 CST 2019

    当前客户端时间

    [root@host1 ~]# date
    Thu Feb 28 20:34:34 CST 2019

    客户端进行时间同步

    [root@host1 ~]# ntpdate 172.20.10.6
    28 Feb 12:24:52 ntpdate[7551]: step time server 172.20.10.6 offset -29488.471623 sec
    [root@host1 ~]# date
    Thu Feb 28 12:25:10 CST 2019

    如果出现下面的错误,稍等再次执行即可

    [root@ken ~]# ntpdate  192.168.1.163
     6 Mar 23:12:36 ntpdate[1541]: no server suitable for synchronization found
  • 相关阅读:
    C++ STL之vector详解
    Two Sum
    The Skyline Problem
    C++ 排序函数 sort(),qsort()的用法
    GO语言为结构体排序
    php将数组或字符串写入文件
    [Zabbix] 怎样实现邮件报警通知以及免费短信报警通知
    js 图片轮转
    ios学习之旅------玩转结构体
    You have ettempted to queue to many files.You may select one files.
  • 原文地址:https://www.cnblogs.com/zhouby/p/10756120.html
Copyright © 2011-2022 走看看