Installation
1, the installation package to download to the window system, through the PSCP command, copy to Linux. PSCP use please refer to the following article: http://www.linuxidc.com/Linux/2012-05/60966.htm
2. Start-run-cmd into the Command Line window and enter the command:
PSCP f:\ Learning \zookeeper\zookeeper-3.4.6.tar.gz [email protected]:/home/lb
Ctrl+alt+f3 into the Virtual Machine Command window, cd/home/lb see zookeeper-3.4.6.tar.gz.
Using TAR–ZXVF zookeeper-3.46.tar.gz Unzip the file, you can see the extracted folder: zookeeper-3.4.6.
3, enter the zookeeper-3.4.6/conf, you can see the zoo_sample.cfg file
4, copy zoo_sample.cfg for zoo.cfg
5. Set Environment variables:
Enter/etc directory, vim profile
Add the following content:
Export zookeeper_install=/home/lb/zookeeper-3.4.6
Add $zookeeper_install/bin to export path
Executes the source profile, and the environment variable is configured.
Start
Environment variables have been configured, so zkserver.sh start can be executed directly in any directory:
Cluster
The cluster simulates two machines, one virtual machine and one PC computer.
Enter the virtual machine under the/zookeeper-3.4.6/conf directory as follows:
Vim Zoo.cfg, add the following information:
server.1=192.168.133.128:2888:3888
server.2=192.168.59.1:2888:3888
Where Server.1 is the virtual machine ip,server.2 for the PC IP.
Cat zoo.cfg View the DataDir directory and create a new file myID in the directory with the content 1. Zookeeper will read myID when it starts to find its corresponding configuration information. Server.1.
Enter the TMP directory, execute the command mkdir zookeeper, and create a new zookeeper directory.
Enter the Zookeeper directory, Vim myID, which contains 1.
Run-cmd, open a command-line window, enter the zookeeper-3.4.6/conf directory, modify the zoo.cfg. Copy the information you added on the virtual machine to your PC.
In the directory where DataDir is located F:\tmp\zookeeper\1 new file myID, content 2.
Start the cluster
The boot sequence starts with Linux and then starts the PC.
In the Linux command Window execute:
zkserver.sh start, output the following information:
View the Vim zookeeper.out content and find the following exception information:
Perform zkserver.sh status and discover the following:
Don't worry about this information and exceptions, this is due to the fact that the PC-side service has not started. Start the PC service below,
Executing at the command line: Zkserver.cmd
At this point the PC end is started. We switched back to Linux to perform zkserver.sh status and found the following:
This means that the PC and virtual machine clusters have been built successfully, and the services on the virtual machine are leader on FOLLOWER,PC.
Zookeeper Linux under Use