Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the running environment of ZooKeeper

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces you how to understand the ZooKeeper operating environment, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Document background:

ZooKeeper has been installed for some time. I stopped for a while, but I found it was rusty when I used it again today. Forget which machines in the cluster zookeeper are installed on.

Objective:

Now make the following notes on how to know zookeeper when you get a new zookeeper environment.

Content of the document:

1. Select a machine in your impression that zookeeper has been installed, and execute the following command [root@datanode1 ~] # echo $ZOOKEEPER_HOME/home/hadoop/modules/ zookeeper [root @ datanode1] # Note:

If there are more than 10 machines, but do not remember which machines their zookeeper is installed on, it will be a very sad thing. At present, I only know that one stupid way is to try one by one.

To avoid using the above stupid approach, we can document the machines in the hadoop cluster, record the roles of each machine, and what software is installed for later check.

2. Find the conf/zoo.cfg file [root@datanode1 ~] # echo $ZOOKEEPER_HOME/home/hadoop/modules/ zookeeper [root @ datanode1 ~] # less / home/hadoop/modules/zookeeper/conf/configuration.xsl log4j.properties zoo.cfg zoo_ sample.cfg [root @ datanode1 ~] # less / home/hadoop/modules/zookeeper/conf/zoo.cfg under the zookeeper installation directory

As can be seen from server.A=B:C:D, the running environment of zookeeper is composed of datanode1, datanode2 and datanode3 machines.

3. Confirm whether $ZOOKEEPER_HOME/conf/zoo.cfg is configured correctly in datanode2 and datanode3

4. Start zookeeper [root @ datanode2 ~] # zkServer.sh startJMX enabled by defaultUsing config: / home/hadoop/modules/zookeeper/bin/../conf/zoo.cfgStarting zookeeper on each machine of the zookeeper cluster. STARTED [root@datanode2 ~] #

Zookeeper does not have its own UI provider unless you install it yourself.

5. View the zookeeper output log

Here, pay attention to check the output log date. Here, the date is 06-02, which is obviously the previous history log, and today's log has not been printed (be sure to remember to check the date, otherwise it will be misled by the output log).

6. View the role to which the current node belongs

[root@datanode1 ~] # zkServer.sh statusJMX enabled by defaultUsing config: / home/hadoop/modules/zookeeper/bin/../conf/zoo.cfgMode: follower [root@datanode1 ~] # [root@datanode2 ~] # zkServer.sh statusJMX enabled by defaultUsing config: / home/hadoop/modules/zookeeper/bin/../conf/zoo.cfgMode: leader [root@datanode2 ~] # [root@datanode3 ~] # zkServer.sh statusJMX enabled by defaultUsing config: / home/hadoop/modules/zookeeper/bin/.. / conf/zoo.cfgMode: follower [root@datanode3 ~] #

It can be seen that datanode2 is leader,datanode1 and datanode3 bit follower.

7. Establish a connection to the service cluster zookeeper at any node

[root@datanode3] # zkCli.sh-server datanode2:2181 on how to understand the ZooKeeper operating environment to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report