本篇内容介绍了“zookeeper-3.4.6集群的搭建步骤”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
我们采用zookeeper-3.4.6来搭建zookeeper集群,硬件为三台DELL服务器(已经关闭防火墙并且配置好ssh互信):
192.168.4.33 bi3
192.168.4.34 bi4
192.168.4.35 bi5
1. 解压zookeeper-3.4.6安装包到/home/hadoop/work目录下:/home/hadoop/work/zookeeper-3.4.6
2. 配置conf/zoo.cfg
# the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=/home/hadoop/work/zookeeper-3.4.6/var/data dataLogDir=/home/hadoop/work/zookeeper-3.4.6/var/datalog # the port at which the clients will connect clientPort=2181 server.1=bi3:2888:3888 server.2=bi4:2888:3888 server.3=bi5:2888:3888
3. 新建目录
mkdir /home/hadoop/work/zookeeper-3.4.6/var/data mkdir /home/hadoop/work/zookeeper-3.4.6/var/datalog
4. 编辑/home/hadoop/work/zookeeper-3.4.6/var/data/myid,三台机器的内容分别如下:
192.168.4.33 bi3 | 1 |
192.168.4.34 bi4 | 2 |
192.168.4.35 bi5 | 3 |
启动zookeeper集群,分别在三台机器上执行下面的命令
/home/hadoop/work/zookeeper-3.4.6/bin/zkServer.sh start
验证集群是否可用
[hadoop@bi5 apps]$ /home/hadoop/work/zookeeper-3.4.6/bin/zkCli.sh -server 127.0.0.1:2181
进入zookeeper的client命令行模式,在根目录下创建/zktest,然后查看是否创建成功
[zk: 127.0.0.1:2181(CONNECTED) 4] create /zktest test Created /zktest [zk: 127.0.0.1:2181(CONNECTED) 5] ls / [consumers, zktest, rmstore, mytest, spark, yarn-leader-election, spark-test, controller_epoch, dubbo, hbase, hadoop-ha, zookeeper, admin, config, brokers] [zk: 127.0.0.1:2181(CONNECTED) 6] get /zktest test cZxid = 0xf0006967b ctime = Mon Feb 15 17:19:32 CST 2016 mZxid = 0xf0006967b mtime = Mon Feb 15 17:19:32 CST 2016 pZxid = 0xf0006967b cversion = 0 dataVersion = 0 aclVersion = 0 ephemeralOwner = 0x0 dataLength = 4 numChildren = 0
“zookeeper-3.4.6集群的搭建步骤”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。