In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the method of building zookeeper environment in hadoop". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the method of building zookeeper environment in hadoop".
Server0ip:192.168.88.155 (hadoop01)
Server1ip:192.168.88.164 (hadoop02)
Server2ip:192.168.88.165 (hadoop03)
Extract it to the app directory
[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
Add
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
one
[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
Enter the host of hadoop02
[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
two
Enter the server of hadoop03
[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
three
Start the cluster
[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
Start hadoop02 in the same way
[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
Start 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
If there is Error contacting service. It is probably not running. Error
Generally speaking, the zookeeper-3.4.5 cluster does not start successfully. If there is still a problem after ensuring that each zookeeper-3.4.5 starts up,
[root@hadoop01 ~] # find /-name zookeeper.out
/ root/Desktop/app/zookeeper-3.4.5/bin/zookeeper.out
Find out the location of the log and view it
Tail-50 / root/Desktop/app/zookeeper-3.4.5/bin/zookeeper.out
Connect the client
[root@hadoop02 bin] # sh zkCli.sh
[zk: localhost:2181 (CONNECTED) 0] help 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
seventy-eight
[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
Connect hadoop03
[zk: localhost:2181 (CONNECTED) 0] get / hadoop
seventy-eight
Threads for kill-9 jps
Thank you for reading, the above is the content of "how to build a zookeeper environment in hadoop". After the study of this article, I believe you have a deeper understanding of the method of building a zookeeper environment in hadoop, and the specific use needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.