hadoop集群时间同步
来源:互联网 发布:c语言递归调用 编辑:程序博客网 时间:2024/06/10 02:00
测试环境:
192.168.217.130 master master.hadoop
192.168.217.131 node1 node1.hadoop
192.168.217.132 node2 node2.hadoop
一、设置master服务器时间
查看本地时间和时区
[root@master ~]# date
Mon Feb 27 09:54:09 CST 2017
选择时区
[root@master ~]# tzselect
[root@master ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
修改时间(date -s 00:00:00或者网络同步:apt-get install ntpdate ; ntpdate cn.pool.ntp.org)
写入硬盘时间(hwclock -w)
二、在master服务器上检查时间服务是否安装
[root@node1 ~]# rpm -q ntp
ntp-4.2.4p8-2.el6.x86_64
如果没有安装,用yum安装
[root@node1 ~]# yum install ntp
按上面的安装方式在内网每台服务器上都安装好NTP软件包。
完成后,都需要配置NTP服务为自启动
[root@master ~]# chkconfig ntpd on
[root@master ~]# chkconfig --list ntpd
ntpd 0:off1:off2:on3:on4:on5:on6:off
三、在master上更改相关配置文件
[root@master ~]# vim /etc/ntp.conf
进行如下修改:
第一处新增,意思是从IP地址192.168.217.1-192.168.217.254,默认网关255.255.255.0的服务器都可以使用我们的NTP服务器来同步时间
第二处新增,指明互联网和局域网中作为NTP服务器的IP
第三处是修改,将原有注释去掉,是当服务器与公用的时间服务器失去联系时以本地时间为客户端提供时间服务
配置文件修改完成,保存退出,启动服务。
[root@master ~]# service ntpd start
启动后,一般需要5-10分钟左右的时候才能与外部时间服务器开始同步时间。可以通过命令查询NTPD服务情况。
查看服务连接和监听
[root@master ~]# netstat -tlunp | grep ntp
udp 0 0 192.168.217.130:123 0.0.0.0:* 4990/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 4990/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 4990/ntpd
udp 0 0 fe80::20c:29ff:fee7:123 :::* 4990/ntpd
udp 0 0 ::1:123 :::* 4990/ntpd
udp 0 0 :::123 :::* 4990/ntpd
重新启动服务
[root@master ~]# service ntpd restart
可设置crontab每天和NTP服务器同步一次(以和互联网时间同步为例)
[root@master ~]# crontab -l
10 23 * * * root (/usr/sbin/ntpdate cn.pool.ntp.org && /sbin/hwclock -w) &> /var/log/ntpdate.log
四、 将其他节点的时间与master进行同步
在其他每一个节点运行命令
[root@node1 ~]# ntpdate master
27 Feb 10:10:15 ntpdate[32724]: adjust time server 192.168.217.130 offset -0.170230 sec
[root@node2 ~]# ntpdate master
27 Feb 10:10:23 ntpdate[30874]: adjust time server 192.168.217.130 offset -0.149563 sec
这时候发现节点间的时间同步了,但ntpdate只在开机运行,我们若要设置为1小时同步一次
[root@node1 ~]# crontab -l
* */1 * * * /usr/sbin/ntpdate master
阅读全文
0 0
- hadoop集群时间同步
- hadoop集群中的时间同步
- hadoop集群 NTP时间同步
- Hadoop集群服务器的时间同步
- linux hadoop本地集群时间同步
- hadoop在linux系统下的集群时间同步
- Hadoop在linux系统下的集群时间同步
- hadoop集群同步实现
- linux集群时间同步
- 集群时间同步
- Linux集群时间同步
- linux集群时间同步
- cendos集群时间同步
- 集群时间同步
- linux集群时间同步
- 集群服务器同步时间
- linux集群时间同步
- 集群机器时间同步
- 在 markdown 中编写 LaTex 数学公式
- 互联网协议(6)——其他协议
- 2017年度15个适用的数据科学领域Python库
- TASKCTL5.0日志乱码解决方案
- 1.IE6金典3px问题
- hadoop集群时间同步
- 哪些 Python 库让你相见恨晚?【转】
- 运动类App 轨迹 多个大头针 蓝牙连接(高德地图)
- 阿里prismplayer播放器文档
- pwnable.tw 001
- Java写入文件以及读取文件
- 数据源技术有那些?使用数据源有什么好处?
- 程序之间共享数据SharedPreferences(二)--sharedUserId
- Cython安装