Zookeeper (1) — start analysis

Starting from this article, I analyze the source code of an open source project from time to time, starting with the famous zookeeper. Why ZK? There are too many scenarios using ZK. Most familiar distributed systems have the shadow of zookeeper, such as HBase, storm, Dubbo, Kafka, etc. in addition, zookeeper is also used in the principle and implementation of the RPC framework mentioned above.

1 Environmental preparation

First, download the new version of ZK. The latest stable version is 3.4 10, because 3.4.0 has been downloaded 9. Use directly first.

1.1 import code

Idea directly opens ZK Directory:

The project is set to jdk1 Then, set main and generated under Src / Java as the source directory, and add the Lib directory as liabary.

1.2 setting profile

In the conf directory, create a new zoo CFG, copy sample CFG is enough

1.3 commissioning configuration

View bin / zkserver

set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
....
endlocal

The call is org apache. zookeeper. server. quorum. Quorumpeermain, so quorumpeermain, configure the debugger, and set the arguments conf / zoo cfg

In this way, you can debug code happily-

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>