您好,登錄后才能下訂單哦!
本篇內容介紹了“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。