关于
hadoop
环境的的搭建有兴趣的朋友请参考本人的另外一篇博客:CentOS6.5 + hadoop2.6 完全分布式安装教程
3. 配置zookeeper-3.4.6/conf/zoo.cfg文件,这个文件本身是没有的,有个zoo_sample.cfg模板
7.先保证集群中已经启动了hadoop,再启动zookeeper,命令:
接下来搭建ZooKeepder: 所有的环境路径依照你们自己的为准,
1. 下载zookeeper-3.4.6.tar.gz.我的目录是/usr/local/hadoop/opt下, 使用# tar –zxvf zookeeper-3.4.6.tar.gz进行解压
2. 配置zookeeper环境变量即 # vi /etc/profile
# cd zookeeper-3.4.6/conf
# vi zoo.cfg
3. 配置zookeeper-3.4.6/conf/zoo.cfg文件,这个文件本身是没有的,有个zoo_sample.cfg模板
# cd zookeeper-3.4.6/conf
# cp zoo_sample.cfg zoo.cfg
# vi zoo.cfg
4.编辑zoo.cfg主要进行如下配置修改,如果有的项,保持不变:vi zoo.cfg
# the number of milliseconds of each tick
ticktime=2000
# the number of ticks that the initial
# synchronization phase can take
initlimit=10
# 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=/usr/local/hadoop/zookeeper-3.4.6/data
# the port at which the clients will connect
clientport=2181
#
# be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperadmin.html
#
# 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=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
5.
创建datadir参数指定的目录,创建data文件夹,在这个文件夹下,还要创建一个文本myid
# cd /usr/local/hadoop/opt/zookeeper-3.4.6
# mkdir data
# vi myid
在myid文件中写下本机对zoo.cfg里的server编号,
在这个文本内写入1,因为server.1=master:2888:3888 server指定的是1,
如果一会在
从机
配置
,slave1下面的myid是2,slave2下面myid是3,这些都是根据server来的。
6. 在主机上配置完成后,白zookeeper复制到从机上对应的目录下,
scp -r zookeeper-3.4.6 root@slave1:/usr/local/hadoop/
scp -r zookeeper-3.4.6 root@slave2:/usr/local/hadoop/
记住在每个从机上配置/etc/profile下zookeeper的环境变量
7.先保证集群中已经启动了hadoop,再启动zookeeper,命令:
zkserver.sh start
记住所以安装zookeeper的机器都要使用该命令启动
基本操作到此结束。