hadoop2.6+ zookeeper3.4.6搭建

关于 hadoop 环境的的搭建有兴趣的朋友请参考本人的另外一篇博客:CentOS6.5 + hadoop2.6 完全分布式安装教程

   接下来搭建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的机器都要使用该命令启动

基本操作到此结束。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值