Zookeeper Series 2: Running zookeeper

Source: Internet
Author: User

Problem Guidance
1. How to start the zookeeper service?
2. How to start a cluster






1) standalone Mode

You can run the following command to start the zookeeper service:
  1. Zkserver. Sh start
Copy code

 

By default, this command runs the zoo. cfg configuration file in the conf folder of zookeeper. When running successfully, you will see a prompt interface similar to the following:
  1. [Email protected]: ~ # Zkserver. Sh start
  2. JMX enabled by default
  3. Using config:/root/hadoop-0.20.2/zookeeper-3.3.1/bin/../CONF/zoo. cfg
  4. Starting zookeeper...
  5. Started
  6. ......
  7. 10:04:42, 300-Warn [main: [email protected]-either no config or no quorum defined in config, running in standalone Mode
  8. ......
  9. 10:04:42, 419-info [main: [email protected]-ticktime set to 2000
  10. 10:04:42, 419-info [main: [email protected]-minsessiontimeout set to-1
  11. 10:04:42, 419-info [main: [email protected]-maxsessiontimeout set to-1
  12. 10:04:42, 560-info [main: [email protected]-binding to port 0.0.0.0/0.0.0.0: 2181
  13. 10:04:42, 806-info [main: [email protected]-reading Snapshot/root/hadoop-0.20.2/zookeeper-3.3.1/data/version-2/snapshot.200000036
  14. 10:04:42, 927-info [main: [email protected]-reading Snapshot/root/hadoop-0.20.2/zookeeper-3.3.1/data/version-2/snapshot.200000036
  15. 10:04:42, 950-info [main: [email protected]-snapshoted: 400000058
Copy code

 

It can be seen from the above that after the operation is successful, the system will list the environment configuration information of zookeeper running.


2) cluster mode

In cluster mode, you need to run the first part of the command on each zookeeper machine.


3) pseudo-distribution mode of clusters

In cluster pseudo-distribution mode, we only have one machine, but we need to run three zookeeper service instances. In this case, the above command will certainly not work. Here, we can run the zookeeper service we configured through the following three commands. As follows:
  1. Zkserver. Sh start zoo1.cfg
Copy code

 

  1. Zkserver. Sh start zoo2.cfg
Copy code
  1. Zkserver. Sh start zoo3.cfg
Copy code

 

After running the first command, the reader will find some system error prompts, as shown in 1:

 

<Ignore_js_op> Figure 1: Cluster pseudo distribution error prompt

 

The exception information shown in is generated because every instance of the zookeeper service has global configuration information, they need to perform the leader election at any time when starting (this part will be described in detail below ). In this case, the first zookeeper to be started needs to communicate with the other two zookeeper instances. However, the other two zookeeper instances are not started, so the exception information shown above will be generated.

 

We can ignore it directly, because when the "2" and "3" zookeeper instances in the figure are started, the corresponding exception information disappears naturally. Article transferred from: http://www.aboutyun.com/thread-9310-1-1.html

 

Zookeeper Series 2: Running zookeeper

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.