這篇文章主要講解了“hadoop中zookeeper環(huán)境的搭建方法”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“hadoop中zookeeper環(huán)境的搭建方法”吧!
我們提供的服務(wù)有:網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、麗江ssl等。為千余家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的麗江網(wǎng)站制作公司
server0ip:192.168.88.155(hadoop01)
server1ip:192.168.88.164(hadoop02)
server2ip:192.168.88.165(hadoop03)
解壓到app目錄下
[root@hadoop02 Desktop]# tar -zxvf zookeeper-3.4.5.tar.gz -C app/
[root@hadoop02 Desktop]# cd app
[root@hadoop02 app]# cd zookeeper-3.4.5
[root@hadoop02 zookeeper-3.4.5]# cd conf
[root@hadoop02 conf]# mv zoo_sample.cfg zoo.cfg
vi zoo.cfg
dataDir=/root/Desktop/app/zookeeper-3.4.5/data
添加
server.1=hadoop01:2888:3888
server.2=hadoop02:2888:3888
server.3=hadoop03:2888:3888
[root@hadoop02 conf]# cd ..
[root@hadoop02 zookeeper-3.4.5]# mkdir data
[root@hadoop02 zookeeper-3.4.5]# cd data
[root@hadoop02 data]# echo 1 >myid
[root@hadoop02 data]# cat myid
1
[root@hadoop02 data]# cd ..
[root@hadoop02 zookeeper-3.4.5]# cd ..
[root@hadoop02 app]# ls
zookeeper-3.4.5
[root@hadoop02 app]# scp -r zookeeper-3.4.5/ hadoop02:/root/Desktop/app
進(jìn)入hadoop02的主機(jī)
[root@localhost ~]# cd /root/Desktop/app
[root@localhost app]# cd zookeeper-3.4.5
[root@localhost zookeeper-3.4.5]# ls
bin dist-maven NOTICE.txt zookeeper-3.4.5.jar.asc
build.xml docs README_packaging.txt zookeeper-3.4.5.jar.md5
CHANGES.txt ivysettings.xml README.txt zookeeper-3.4.5.jar.sha1
conf ivy.xml recipes
contrib lib src
data LICENSE.txt zookeeper-3.4.5.jar
[root@localhost zookeeper-3.4.5]# cd data
[root@localhost data]# ls
myid
[root@localhost data]# echo 2 >myid
[root@localhost data]# cat myid
2
進(jìn)入hadoop03的server
[root@localhost app]# cd zookeeper-3.4.5
[root@localhost zookeeper-3.4.5]# ls
bin docs README.txt
build.xml ivysettings.xml recipes
CHANGES.txt ivy.xml src
conf lib zookeeper-3.4.5.jar
contrib LICENSE.txt zookeeper-3.4.5.jar.asc
data NOTICE.txt zookeeper-3.4.5.jar.md5
dist-maven README_packaging.txt zookeeper-3.4.5.jar.sha1
[root@localhost data]# ls
myid
[root@localhost data]# echo 3 >myid
[root@localhost data]# cat myid
3
啟動(dòng)集群
[root@hadoop02 conf]# cd ..
[root@hadoop02 zookeeper-3.4.5]# cd bin
[root@hadoop02 bin]# ./zkServer.sh start
JMX enabled by default
Using config: /root/Desktop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@hadoop02 bin]# jps
5386 NodeManager
20801 Jps
4912 DataNode
5288 ResourceManager
17430 QuorumPeerMain
5126 SecondaryNameNode
同理啟動(dòng)hadoop02
[root@localhost zookeeper-3.4.5]# cd bin
[root@localhost bin]# ls
README.txt zkCli.cmd zkEnv.cmd zkServer.cmd
zkCleanup.sh zkCli.sh zkEnv.sh zkServer.sh
[root@localhost bin]# ./zkServer.sh start
JMX enabled by default
Using config: /root/Desktop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# jps
9635 QuorumPeerMain
5538 SecondaryNameNode
5722 ResourceManager
9649 Jps
5195 NameNode
5820 NodeManager
5322 DataNode
啟動(dòng)hadoop03
root@localhost zookeeper-3.4.5]# cd bin
[root@localhost bin]# ls
README.txt zkCli.cmd zkEnv.cmd zkServer.cmd
zkCleanup.sh zkCli.sh zkEnv.sh zkServer.sh
[root@localhost bin]# ./zkServer.sh start
JMX enabled by default
Using config: /root/Desktop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@localhost bin]# jps
9275 Jps
5520 SecondaryNameNode
5691 ResourceManager
5789 NodeManager
9251 QuorumPeerMain
5310 DataNode
hadoop01
[root@hadoop02 bin]# ./zkServer.sh status
JMX enabled by default
Using config: /root/Desktop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: follower
hadoop02
[root@localhost bin]# ./zkServer.sh status
JMX enabled by default
Using config: /root/Desktop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: leader
hadoop03
root@localhost bin]# ./zkServer.sh status
JMX enabled by default
Using config: /root/Desktop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: follower
若出現(xiàn)Error contacting service. It is probably not running. error
一般是zookeeper-3.4.5 集群?jiǎn)?dòng)不成功, 在確保每臺(tái)zookeeper-3.4.5啟動(dòng)后若還是出現(xiàn)問(wèn)題
[root@hadoop01 ~]# find / -name zookeeper.out
/root/Desktop/app/zookeeper-3.4.5/bin/zookeeper.out
找出日志的位置查看
tail -50 /root/Desktop/app/zookeeper-3.4.5/bin/zookeeper.out
連接客戶端
[root@hadoop02 bin]# sh zkCli.sh
[zk: localhost:2181(CONNECTED) 0] help幫助
[zk: localhost:2181(CONNECTED) 1] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 2] create /hadoop 78
Created /hadoop
[zk: localhost:2181(CONNECTED) 4] get /hadoop
78
[zk: localhost:2181(CONNECTED) 7] set /hadoop xxxx
[zk: localhost:2181(CONNECTED) 5] create /hadoop/test mon:hadooop;tue:hdfs;
Created /hadoop/test
[zk: localhost:2181(CONNECTED) 6] get /hadoop/test
mon:hadooop;tue:hdfs;
連接hadoop03
[zk: localhost:2181(CONNECTED) 0] get /hadoop
78
kill -9 jps的線程
感謝各位的閱讀,以上就是“hadoop中zookeeper環(huán)境的搭建方法”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)hadoop中zookeeper環(huán)境的搭建方法這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
當(dāng)前題目:hadoop中zookeeper環(huán)境的搭建方法
網(wǎng)站鏈接:http://jinyejixie.com/article46/gggieg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、網(wǎng)站改版、電子商務(wù)、網(wǎng)站設(shè)計(jì)、網(wǎng)站排名、App開(kāi)發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)