rpm –qa | grep ntp
yum –y remove ntpdate-....
yum –y install ntp
vi /etc/ntp.conf
打开之后是这个样子,然后添加两行代码
restrict 192.168.6.3 nomodify notrap nopeer noquery //当前节点IP地址
restrict 192.168.6.2 mask 255.255.255.0 nomodify notrap //集群所在网段的网关(Gateway),子网掩码(Genmask)
注:选择作为主节点的机器不一定是hadoop的主节点,这可以随意自定,但是选择之前要去查看作为主节点的机器时间是否正确,输入date
查看。
如果集群机器时间都不正确可以选择一台进行修改:date -s 填写当前的时间
把原先server注掉,在server部分下面添加如下语句
server 127.127.1.0
Fudge 127.127.1.0 stratum 10 ---每10秒更新一次
把原先server注掉,在server部分下面添加如下语句
server 192.168.222.121 --当前主机ip地址
Fudge 192.168.222.121 stratum 10 --当前主机ip地址
service ntpd start
ntpstat
然后可以输入date
进行查看
ntpq -p
vim /etc/sysconfig/ntpd
-----------------------
# 增加内容如下(让硬件时间与系统时间一起同步)
SYNC_HWCLOCK=yes
重新启动ntpd
service ntpd status
service ntpd start
chkconfig ntpd on
其他机器配置
crontab -e
----------------
*/10 * * * * /usr/sbin/ntpdate hadoop2
1.单机不能配置zookeeper
2.配置zookeeper不能配置双数台,只能配置三台、五台这样的hadoop集群。
tar -zxvf zookeeper-3.4.6.tar.gz -C /opt
mv zookeeper-3.4.6/ zookpr
# The number of milliseconds of each tick
tickTime=2000
maxClientCnxns=0
# The number of ticks that the initial
# synchronization phase can take
initLimit=50
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/opt/hadoop/zookprdata --这值修改数据存放的地方,可以不做修改,但是建议改到hadoop下面
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=hadoop101:2888:3888 --hadoop101是主机名
server.2=hadoop102:2888:3888
server.3=hadoop103:2888:3888
mv zoo_sample.cfg zoo.cfg --将配置文件改名
scp zoo.cfg [email protected]:/opt/zookpr/conf/ --将改名后的配置文件传输到其他机器相应的位置,并删除其他文件原有的文件
rm -rf zoo_sample.cfg --删除其他机器上原有的文件
cd /opt/hadoop --进入hadoop文件,这里的hadoop是被改过名字的
mkdir zookprdata -新建zookeeper数据存放位置
cd zookprdata/ --进入zookprdata文件夹
vi myid --新建myid文件
在各zookeeper节点上运行zkServer.sh start。
cd /opt/zookpr --进入zookpr
./bin/zkServer.sh start --启动zookpr
tail zookeeper.out --查看