标签:mini conf pre amp nop details mirror with ntpd
我的hadoop 节点有两个, 两个cdhslave节点,一个master节点;
cdh02,cdh03为slave节点,cdh01为master节点
ntp服务器和两个节点,两个节点的时间从master节点获取时间并进行同步。
在master节点 先检查有没有ntp fuwu安装
rpm -qa | grep ntp
以上代码如果有这个安装包,先进行清理;
后安装ntp
yum install -y ntp
[root@cdh01 ~]# yum install -y ntp Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com Resolving Dependencies --> Running transaction check ---> Package ntp.x86_64 0:4.2.6p5-29.el7.centos will be installed --> Processing Dependency: ntpdate = 4.2.6p5-29.el7.centos for package: ntp-4.2.6p5-29.el7.centos.x86_64 --> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-29.el7.centos.x86_64 --> Running transaction check ---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed ---> Package ntpdate.x86_64 0:4.2.6p5-29.el7.centos will be installed --> Finished Dependency Resolution Dependencies Resolved # Please consider joining the pool (http://www.pool.ntp.org/join.html). =========================================================================================================================== Package Arch Version Repository Size ===========================================================================================================================
以上为安装日志
安装完后
进行配置
vi /etc/ntp.conf
在根目录进行以上配置
配置文件如下
# For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict ::1 # Hosts on local network are less restricted. ################################# ###改这里 restrict 172.16.9.130 mask 255.255.255.0 nomodify notrap #这里把ip地址改成你的master(本机)de ip地址 ######################################### # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). ####+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++++++ #下面的这些服务器全部注释掉 ################################### #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 #++++++++++++++++++++++++++++++++++ #注释在这里结束+++++++++++++++++++++++++ #broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 autokey # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 autokey # manycast client # Enable public key cryptography. #crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating # with symmetric key cryptography. keys /etc/ntp/keys # Specify the key identifiers which are trusted. #trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility. #requestkey 8 # Specify the key identifier to use with the ntpq utility. #controlkey 8 # Enable writing of statistics records. #statistics clockstats cryptostats loopstats peerstats # Disable the monitoring facility to prevent amplification attacks using ntpdc # monlist command when default restrict does not include the noquery flag. See # CVE-2013-5211 for more details. # Note: Monitoring will not be disabled with the limited restriction flag. disable monitor #+++++++++++++++++++++++++++++++++++++++++++++++ #+++++最后加上这两句+++++++++++++++++++++++++++++++++ server 127.127.1.0 fudge 127.127.1.0 stratum 10 #以上所有的配置,先吧时间区域改成上海,再进行
然后把服务设置成开机启动...
chkconfig ntpd on
然后 启动服务
systemctl start ntpd
----------------------------------------------------
master节点配置结束
接下来我们配置slave节点
在slave节点一下命令进行配置
crontab -e
然后文件内容输入一下内容:
0-59/5 * * * * /usr/sbin/ntpdate cdh01
# cdh01 为maister节点的hostname(之前在hosts文件里已经配置过映射)
0-59为 任何一秒
5 为每个五分钟同步一次时间
cdh02,cdh03两个节点都进行这个配置。
ntp服务配置完毕
标签:mini conf pre amp nop details mirror with ntpd
原文地址:https://www.cnblogs.com/MegaByte/p/12234106.html