Let's say how to install zookeeper under Linux.
1, download. http://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/
Choose the version you want to install, I use http://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.3.6/
2. Put it on Linux and unzip it to your target directory.
The command is: TAR-XZVF file directory-c destination directory. Such as:
3, configuration.
First come to your installation location, and the CD goes in. Lists all files. Such as:
Here are the Bin directory and the Conf directory, as well as some jars.
The bin is the folder where the files are executed and Conf is the profile folder.
Here to say the configuration, we look at conf inside what some ghost.
We see there is a log4j log file, there is a zoo_sample file, Zoo_sample is a configuration template, then we configure the template for reference. Copy one directly, named ZOO.FG.
Here I have given this zoo.cfg file authorization, do you want to authorize according to your own needs.
Let's open the zoo.cfg and see what's inside. Execute command: VI zoo.cfg, the result is as follows:
Let's take a look at what these parameters represent.
Ticktime: Heartbeat configuration, Unit milliseconds, two heartbeats failed to down.
Initlimit: After how many heartbeat times, allow other servers to initialize.
Synclimit: How many ticktime within, allow follower synchronization, if follower is too much behind, it will be discarded
DataDir
The folder where the memory database snapshot is stored, and the myID file for the cluster also exists in this folder ( Note: A configuration file can contain only one datadir typeface, even if it is commented out.) )
clientport=2181 # Service Listening port, can be modified as needed
Please refer to the official documentation or find a connection for the specific parameters: http://blog.sina.com.cn/s/blog_a577cd8a01014whx.html
I put the data directory in my Apps directory under the Zk-data folder, modified to save the exit:
Note: You can also configure the cluster through the server parameters (not explained in detail here), as follows:
server.1=192.168.18.102:2888:3888
server.2=192.168.18.103:2888:3888
server.3=192.168.18.104:2888:3888
4, start (the fruit of the acceptance of fruits bar)
We go to the bin directory and start up (Start is start, reboot is Restart,status is look state, start client is zkcli.sh-server 127.0.0.1:2181,-server 127.0.0.1:2181 This is the IP and port of the service server )
We start the client and try the server
The client connection was successful and the server was properly certified.
All right, let's get here today. Hungry, eating.
Install zookeeper under Linux