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:
- 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:
- [Email protected]: ~ # Zkserver. Sh start
- JMX enabled by default
- Using config:/root/hadoop-0.20.2/zookeeper-3.3.1/bin/../CONF/zoo. cfg
- Starting zookeeper...
- Started
- ......
- 10:04:42, 300-Warn [main: [email protected]-either no config or no quorum defined in config, running in standalone Mode
- ......
- 10:04:42, 419-info [main: [email protected]-ticktime set to 2000
- 10:04:42, 419-info [main: [email protected]-minsessiontimeout set to-1
- 10:04:42, 419-info [main: [email protected]-maxsessiontimeout set to-1
- 10:04:42, 560-info [main: [email protected]-binding to port 0.0.0.0/0.0.0.0: 2181
- 10:04:42, 806-info [main: [email protected]-reading Snapshot/root/hadoop-0.20.2/zookeeper-3.3.1/data/version-2/snapshot.200000036
- 10:04:42, 927-info [main: [email protected]-reading Snapshot/root/hadoop-0.20.2/zookeeper-3.3.1/data/version-2/snapshot.200000036
- 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:
- Zkserver. Sh start zoo1.cfg
Copy code
- Zkserver. Sh start zoo2.cfg
Copy code
- 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