Cloudera 建议使用 NTP 使 Hadoop 群集实现时间同步
2015-04-13 16:54
357 查看
主机的 NTP 服务未响应时钟偏差请求。
建议
这是主机运行状况测试,用于检查主机的系统时钟是否与其 NTP 服务器不同步。该测试能检查“ntpdc -c loopinfo”命令报告的主机时钟偏差绝对值是否未过大。如果该命令失败或主机的 NTP 后台程序未运行,该测试将返回运行状况“不良”。如果 NTP 未在主机上使用,应对使用以下配置选项的主机禁用该检查。Cloudera 建议使用 NTP 使 Hadoop 群集实现时间同步。
该运行状况测试失败可能表示主机的 NTP 服务或配置出现问题。
可使用 主机时钟偏差阈值 主机配置设置来配置该测试。
时区更改:(东八区)
cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#reboot
选择Node1 节点为时钟同步服务器,其他节点为客户端同步时间到该节点。
安装NTP
$ yum install ntp 启动ntp #service ntpd restart <===启动ntp服务 说明:NTP服务启动需要大约五分钟时间,服务启动之前,若客户端同步时间,则会出现错误“no server suitable for synchronization found” 定时同步时间: 在work02和 work03上配置crontab定时同步时间 crontab -e 00 12 * * * root /usr/sbin/ntpdate 192.168.249.131 >> /root/ntpdate.log 2>&1
查看任务
crontab -l
[/code]
1.3 时钟同步
搭建时钟同步服务器
这里选择 cdh1 节点为时钟同步服务器,其他节点为客户端同步时间到该节点。、安装ntp:
$ yum install ntp
修改 cdh1 上的配置文件
/etc/ntp.conf:
restrict default ignore //默认不允许修改或者查询ntp,并且不接收特殊封包 restrict 127.0.0.1 //给于本机所有权限 restrict 192.168.56.0 mask 255.255.255.0 notrap nomodify //给于局域网机的机器有同步时间的权限 server 192.168.56.121 # local clock driftfile /var/lib/ntp/drift fudge 127.127.1.0 stratum 10
启动 ntp:
$ service ntpd start
设置开机启动:
$ chkconfig ntpd on
ntpq用来监视ntpd操作,使用标准的NTP模式6控制消息模式,并与NTP服务器通信。
ntpq -p查询网络中的NTP服务器,同时显示客户端和每个服务器的关系。
$ ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *LOCAL(1) .LOCL. 5 l 6 64 1 0.000 0.000 0.000
"* ":响应的NTP服务器和最精确的服务器。
"+":响应这个查询请求的NTP服务器。
"blank(空格)":没有响应的NTP服务器。
"remote" :响应这个请求的NTP服务器的名称。
"refid ":NTP服务器使用的更高一级服务器的名称。
"st":正在响应请求的NTP服务器的级别。
"when":上一次成功请求之后到现在的秒数。
"poll":当前的请求的时钟间隔的秒数。
"offset":主机通过NTP时钟同步与所同步时间源的时间偏移量,单位为毫秒(ms)。
客户端的配置
在cdh2和cdh3节点上执行下面操作:$ ntpdate cdh1
Ntpd启动的时候通常需要一段时间大概5分钟进行时间同步,所以在ntpd刚刚启动的时候还不能正常提供时钟服务,报错"no server suitable for synchronization found"。启动时候需要等待5分钟。
如果想定时进行时间校准,可以使用crond服务来定时执行。
00 1 * * * root /usr/sbin/ntpdate 192.168.56.121 >> /root/ntpdate.log 2>&1
这样,每天 1:00 Linux 系统就会自动的进行网络时间校准。
相关文章推荐
- Cloudera 建议使用 NTP 使 Hadoop 群集实现时间同步
- NTP协议以及ntpclinet使用 From Evernote: NTP协议以及ntpclinet使用 NTP全称是Network Time Protocol,是用来让计算机之间实现时间同步的协议
- linux同步时间错误 使用 ntpdate命令
- arm开发板使用ntp与服务器同步时间
- NTP协议网络时间同步 ios中应用 实现秒杀倒计时
- 使用C#实现网络时间同步功能
- ubuntu ntp 时间同步 搭建 使用
- 使用NTP协议服务器时间同步
- arm开发板使用ntp与服务器同步时间
- 使用iojs的jsdom库实现同步系统时间
- CentOS7 中使用NTP进行时间同步
- Linux之通过NTP协议实现服务器时间同步的源码
- Linux系统下使用ntpdate同步时间
- NTP 时间同步流量使用过大 问题解决
- 使用windows自带ntp客户端进行时间同步的方法
- 使用NTP同步系统时间
- 使用windows自带ntp客户端进行时间同步的方法
- redhat使用ntpdate同步时间服务器新手注意事项
- Android手机虚拟CD-ROM流程 && 使用网络同步时间(NITZ和NTP)&& Android VOLD
- Linux下使用ntpdate进行时间同步