Hadoop集群时间同步
0x01 ntp安装
1.1 检查时间服务器是否安装
# rpm -q ntp
ntp-4.2.4p8-2.el6.x86_64 // 这表示已安装了,如果没有安装,这是空白。
//如果没有安装,通过以下命令进行安装
# yum install ntp
1.2 设置ntp自启动
按上面的安装方式在内网每台服务器上都安装好ntp软件包。
完成后,都需要配置ntp服务为自启动
# chkconfig ntpd on
# chkconfig --list ntpd
ntpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
1.3 手动同步时间
在配置前,先使用ntpdate手动同步下时间,免得本机与外部时间服务器时间差距太大,让ntpd不能正常同步。
# ntpdate -u 202.112.10.36
22 Dec 16:52:38 ntpdate[6400]: adjust time server 202.112.10.36 offset 0.012135 sec
0x02 ntp配置
2.1 修改配置文件ntp.cnf
vim /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 kod nomodify notrap nopeer noquery
restrict -6 default kod 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 -6 ::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).
# 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn
server 210.72.145.44 perfer # 中国国家受时中心
server 202.112.10.36 # 1.cn.pool.ntp.org
server 59.124.196.83 # 0.asia.pool.ntp.org
#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
# allow update time by the upper server
# 允许上层时间服务器主动修改本机时间
restrict 210.72.145.44 nomodify notrap noquery
restrict 202.112.10.36 nomodify notrap noquery
restrict 59.124.196.83 nomodify notrap noquery
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
# 外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
# 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
配置文件修改完成,保存退出。
启动服务:
# service ntpd start
0x03 在其它节点上与master节点时间同步
# ntpdate master
这时候发现节点间的时间同步了,但ntpdate只在开机运行,我们若要设置为1小时同步一次
安装完以后使用crontab来自动更新时间:
# crontab -e
添加如下行:
* */1 * * * /usr/sbin/ntpdate 192.168.64.11
使用date命令发现所有节点时间已经一致。
0x04 同步过程中的问题
4.1 the NTP socket is in use
Linux下 ntp 时间同步服务ntpd 出现 the NTP socket is in use, exiting 解决
# service ntpd stop
Shutting down ntpd: [ OK ]
# ntpdate master
6 Sep 09:37:19 ntpdate[30658]: step time server 192.168.1.10 offset -51.869609 sec
2017年1月23日, 星期一
Hadoop集群时间同步的更多相关文章
- Hadoop入门 集群时间同步
集群时间同步 如果服务器在公网环境(能连接外网),可以不采用集群时间同步.因为服务器会定期和公网时间进行校准. 如果服务器在内网环境,必须要配置集群时间同步,否则时间久了,会产生时间偏差,导致集群执行 ...
- 配置NTP服务ntpd/ntp.conf(搭建Hadoop集群可参考)
本文拟定是在一个局域网内(比如一个Hadoop集群)设定一台NTP服务器作为整个网络的标准时间参考,使用网络(集群)内的所有机器保持时间一致!以下是详细的操作步骤: 1. 修改选定的服务器的本地时间 ...
- 使用yum安装CDH Hadoop集群
使用yum安装CDH Hadoop集群 2013.04.06 Update: 2014.07.21 添加 lzo 的安装 2014.05.20 修改cdh4为cdh5进行安装. 2014.10.22 ...
- 使用Ambari部署hadoop集群
准备工作 1. 设置sudo免密码登陆 由于CentOS安装之后,普通用户无sudo权限,故应该设置sudo权限. 参考文章:http://www.cnblogs.com/maybob/p/32988 ...
- linux集群时间同步
说明:由于hadoop集群对时间要求很高,所以集群内主机要经常同步.本文档适合ubuntu.redhat系列. 注:很多内容是在网上摘录,然后试验后总结,如有疑问可留言探讨. 1.设置主机时间准确(任 ...
- linux hadoop 集群安装步骤
http://blog.csdn.net/xjavasunjava/article/details/12013677 1,时间同步hadoop集群的每台机器的时间不能相差太大. 安装集群前最好进行一下 ...
- HADOOP集群监控工具AMBARI
HADOOP集群监控工具AMBARI安装 Apache Ambari是对Hadoop进行监控.管理和生命周期管理的开源项目.它也是一个为Hortonworks数据平台选择管理组建的项目.Ambari向 ...
- hadoop集群监控工具ambari安装
Apache Ambari是对Hadoop进行监控.管理和生命周期管理的基于网页的开源项目.它也是一个为Hortonworks数据平台选择管理组建的项目.Ambari支持管理的服务有: Apache ...
- yum安装CDH5.5 Hadoop集群
1.环境说明 系统环境: 系统环境:centos6.7 Hadoop版本:CDH5.5 JDK运行版本:1.7.0_67 集群各节点组件分配: 2.准备工作 安装 Hadoop 集群前先做好下面的准备 ...
随机推荐
- VB6获取IE8的地址栏的URL信息
这是个老梗了,也没什么技术含量.因为自从接触Linux之后,Windows上我所知道的那一点api基本上都忘光了.所以这样的博文可以当做是备忘,说不定有天还能用的到. Windows上想要获取浏览器的 ...
- hdu2413(二分+二分匹配)
题意:人和外星人星球大战,人总共有H个星球,外星人有A个星球,现在人要用飞船去打外星人的飞船,要求每个人类星球只能对战一个外星球,且每个星球都开始有己知的飞船数,不论是人或外星人的星球,并每个星球都有 ...
- python学习笔记之运算符
目录 前言 软件环境 身份运算符 算术运算符 比较运算符 位移运算符 自变运算符 位运算符 逻辑运算符 成员关系运算符 Python真值表 最后 前言 在前面的博文介绍了Python的数据结构之后,接 ...
- Unreal Engine 4 Radiant UI 插件入门(三)——从蓝图中调用JS
不知道大家有没有混淆.这篇教程说的是从蓝图中调用JS的功能(以改变H5内的内容). 在安装了UE4和RadiantUI的前提下学习这篇教程.本篇教程接着上一篇教程,建议请先看上一篇. 第一步:在网页中 ...
- centos 6.5系统判断软件是否安装,如果没安装,则直接使用yum安装,并添加启动项
function install_software(){ software=$1 s=`rpm -qa|grep ${software}` result=$(echo ${s}|grep ${soft ...
- 数控G代码编程详解大全
一.G代码功能简述 G00------快速定位 G01------直线插补 G02------顺时针方向圆弧插补 G03------逆时针方向圆弧插补 G04------定时暂停 G05------通 ...
- 机器学习 —— 基础整理(五)线性回归;二项Logistic回归;Softmax回归及其梯度推导;广义线性模型
本文简单整理了以下内容: (一)线性回归 (二)二分类:二项Logistic回归 (三)多分类:Softmax回归 (四)广义线性模型 闲话:二项Logistic回归是我去年入门机器学习时学的第一个模 ...
- GetConsoleTitle 函数--获取控制台窗口标题
GetConsoleTitle函数 来源:https://msdn.microsoft.com/en-us/library/windows/desktop/ms683174(v=vs.85).aspx ...
- aspcms多图调用以及错误提示:3704
1.“为师资介绍”(相册列表)建立了内容页(相册内容页), 需要对模板页面改造,在相册详细页调用多图,之前没有试过,这次利用: 实现多图调用,注意不能使用contentid=[content:id] ...
- jsp变量的使用规则
jsp是一种弱类型的交而不能语音,虽然看似没有像强类型语言那么多的代码规范,但是在实际使用的过程当中依然有不少的问题.下面就简单的梳理一下. 1.首先,jsp是一种弱类型的脚本语言,变量在使用之前无需 ...