Hadoop基础教程-第10章 HBase:Hadoop数据库(10.4 NTP时间同步)(草稿)
2017-07-25 22:42
519 查看
第10章 HBase:Hadoop数据库
10.4 NTP时间同步
10.4.1 为什么需要时间同步
HBase的HMaster和HRegionServer启动失败,大多是因为集群时间不同步造成的。需要定时进行集群时间同步。10.4.1 ntp服务端
(1)安装ntp[root@node1 ~]# yum install -y ntp ..... Installing: ntp x86_64 4.2.6p5-25.el7.centos.2 updates 547 k Installing for dependencies: autogen-libopts x86_64 5.18-5.el7 base 66 k ntpdate x86_64 4.2.6p5-25.el7.centos.2 updates 86 k Transaction Summary ============================================================================================================================================================================================= Install 1 Package (+2 Dependent packages) Total download size: 699 k Installed size: 1.6 M Downloading packages: (1/3): autogen-libopts-5.18-5.el7.x86_64.rpm | 66 kB 00:00:00 (2/3): ntpdate-4.2.6p5-25.el7.centos.2.x86_64.rpm | 86 kB 00:00:00 (3/3): ntp-4.2.6p5-25.el7.centos.2.x86_64.rpm | 547 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 726 kB/s | 699 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : autogen-libopts-5.18-5.el7.x86_64 1/3 Installing : ntpdate-4.2.6p5-25.el7.centos.2.x86_64 2/3 Installing : ntp-4.2.6p5-25.el7.centos.2.x86_64 3/3 Verifying : ntp-4.2.6p5-25.el7.centos.2.x86_64 1/3 Verifying : ntpdate-4.2.6p5-25.el7.centos.2.x86_64 2/3 Verifying : autogen-libopts-5.18-5.el7.x86_64 3/3 Installed: ntp.x86_64 0:4.2.6p5-25.el7.centos.2 Dependency Installed: autogen-libopts.x86_64 0:5.18-5.el7 ntpdate.x86_64 0:4.2.6p5-25.el7.centos.2 Complete! [root@node1 ~]#
(2)配置/etc/ntp.conf
[root@node1 ~]# vi /etc/ntp.conf
只需将
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap修改为
restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap,给局域网内主机同步时间的权限,但不允许修改时间服务器的时间。
完整的配置文件如下:
[root@node1 ~]# cat /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 192.168.1.0 mask 255.255.255.0 nomodify notrap # 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 [root@node1 ~]#
(3)开机启动ntp
[root@node1 ~]# systemctl start ntpd [root@node1 ~]# systemctl enable ntpd Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service. [root@node1 ~]#
[root@node1 ~]# systemctl status ntpd ● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2017-07-25 10:40:48 EDT; 3min 18s ago Main PID: 2504 (ntpd) CGroup: /system.slice/ntpd.service └─2504 /usr/sbin/ntpd -u ntp:ntp -g Jul 25 10:40:48 node1 ntpd[2504]: Listen and drop on 1 v6wildcard :: UDP 123 Jul 25 10:40:48 node1 ntpd[2504]: Listen normally on 2 lo 127.0.0.1 UDP 123 Jul 25 10:40:48 node1 ntpd[2504]: Listen normally on 3 ens32 192.168.80.131 UDP 123 Jul 25 10:40:48 node1 ntpd[2504]: Listen normally on 4 lo ::1 UDP 123 Jul 25 10:40:48 node1 ntpd[2504]: Listen normally on 5 ens32 fe80::20c:29ff:fe9c:13bd UDP 123 Jul 25 10:40:48 node1 ntpd[2504]: Listening on routing socket on fd #22 for interface updates Jul 25 10:40:48 node1 ntpd[2504]: 0.0.0.0 c016 06 restart Jul 25 10:40:48 node1 ntpd[2504]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM Jul 25 10:40:48 node1 ntpd[2504]: 0.0.0.0 c011 01 freq_not_set Jul 25 10:40:55 node1 ntpd[2504]: 0.0.0.0 c614 04 freq_mode [root@node1 ~]#
10.4.2 ntp客户端
安装ntp客户端,只需安装ntpdate[root@node2 ~]# yum install -y ntpdate
[root@node3 ~]# yum install -y ntpdate
时间同步
[root@node2 ~]# ntpdate 192.168.80.131 25 Jul 11:03:47 ntpdate[2243]: adjust time server 192.168.80.131 offset -0.014726 sec [root@node2 ~]#
[root@node3 ~]# ntpdate 192.168.80.131 25 Jul 11:03:35 ntpdate[2228]: adjust time server 192.168.80.131 offset -0.034661 sec [root@node3 ~]#
相关文章推荐
- Hadoop基础教程-第10章 HBase:Hadoop数据库(10.5 HBase Shell)(草稿)
- Hadoop基础教程-第10章 HBase:Hadoop数据库(10.3 HBase安装与配置)(草稿)
- Hadoop基础教程-第10章 HBase:Hadoop数据库(10.2 HBase基本概念、框架)(草稿)
- Hadoop基础教程-第10章 HBase:Hadoop数据库(10.1 NoSQL介绍)(草稿)
- Hadoop基础教程-第10章 HBase:Hadoop数据库(10.6 HBase API)
- Hadoop基础教程-第10章 HBase:Hadoop数据库(10.7 HBase 批量导入)
- Hadoop基础教程-第5章 YARN:资源调度平台(5.5 YARN的调度器)(草稿)
- Hadoop基础教程-第6章 MapReduce入门(6.5 温度统计)(草稿)
- Hadoop基础教程-第11章 Hive:SQL on Hadoop(11.5 HQL:DDL数据定义)(草稿)
- Hadoop基础教程-第6章 MapReduce入门(6.4 MapReduce程序框架)(草稿)
- Hadoop基础教程-第7章 MapReduce进阶(7.3 MapReduce API)(草稿)
- Hadoop基础教程-第9章 HA高可用(9.2 HDFS 高可用配置)(草稿)
- Hadoop基础教程-第5章 YARN:资源调度平台(5.6 YARN的命令)(草稿)
- 【Nutch2.3基础教程】集成Nutch/Hadoop/Hbase/Solr构建搜索引擎:安装及运行【集群环境】 分类: 1_Nutch 0_jediael开发 2015-01-24 17:24 3522人阅读 评论(1) 收藏
- Hadoop基础教程-第9章 HA高可用(9.1 HDFS 高可用介绍)(草稿)
- 【Nutch2.3基础教程】集成Nutch/Hadoop/Hbase/Solr构建搜索引擎:安装及运行【集群环境】
- Hadoop基础教程-第5章 YARN:资源调度平台(5.4 YARN集群运行)(草稿)
- Hadoop基础教程-第5章 YARN:资源调度平台(5.1 YARN介绍)(草稿)
- Hadoop基础教程-第9章 HA高可用(9.4 YARN 高可用)(草稿)
- 【Nutch2.3基础教程】集成Nutch/Hadoop/Hbase/Solr构建搜索引擎:安装及运行【集群环境】