I now make a summary of the environment of the zookeeper, general zookeeper installation can have three modes, single-machine mode, pseudo-distributed and distributed, when the three modes of application specific to see everyone's use of the scene, if you only have a machine and just want to develop their own testing, You can install a single-machine mode, simple and practical. If you want to install the force but do not have enough machines, then you can choose the pseudo-distributed way to build, which can meet your internal high-distributed demand and can meet the lack of machine of the cock silk status. If you have more than three servers on hand, it can be a high-profile, directly on the real distribution, the real distributed deployment is generally in the formal environment of the system application. Let me give you an introduction to these three types of building patterns.
I use the CentOS system, Zookeeper-3.4.9,java-1.8,java environment and zookeeper download I will not say more here, all my operations are in the/data/zookeeper directory.
First, stand-alone mode
1. Create a new directory Zookeeper_single and copy the downloaded zookeeper-3.4.9.tar.gz into the directory.
2. Unzip the zookeeper.
TAR–ZXVF zookeeper-3.4.9.tar.gz
3. Create a new Data,logs two folder under the zookeeper-3.4.9 directory.
4. Enter the zookeeper-3.4.9/conf directory and change the zoo_sample.cfg file to Zoo.cfg
CP Zoo_sample.cfg Zoo.cfg
5. Modify the Zoo.cfg file, you need to modify the following several places.
Datadir=/data/zookeeper/zookeeper_single/zookeeper-3.4.9/data
Datalogdir=/data/zookeeper/zookeeper_single/zookeeper-3.4.9/logs
clientport=2181
6. After the configuration, you can start the Zookeeper service, enter the Zookeeper-3.4.9/bin directory, start the Zookeeper service.
./zkserver.sh Start
7. When the boot is complete, review the service status.
./zkserver.sh Status
Second, pseudo-distributed mode
1. Create a new directory Zookeeper_cluster_fake and copy the downloaded zookeeper-3.4.9.tar.gz into the directory.
2. Unzip the zookeeper.
TAR–ZXVF zookeeper-3.4.9.tar.gz
3. After decompression, rename the zookeeper-3.4.9 to zookeeper_01 and create a new Data,logs two folder in the Zookeeper_01 directory.
4. Enter the zookeeper_01/conf directory and change the zoo_sample.cfg file to Zoo.cfg
CP Zoo_sample.cfg Zoo.cfg
5. Two copies of the zookeeper_01 are named Zookeeper_02 and zookeeper_03 respectively.
CP zookeeper_01 ZOOKEEPER_02
CP zookeeper_01 ZOOKEEPER_03
6. Modify the Zoo.cfg file in the Conf directory in zookeeper_01,zookeeper_02 and zookeeper_03 respectively.
Configuration of the zookeeper_01:
Datadir=/data/zookeeper/zookeeper_cluster_fake/zookeeper_01/data
Datalogdir=/data/zookeeper/zookeeper_cluster_fake/zookeeper_01/logs
clientport=2181
server.1=192.168.71.82:2881:3881
server.2=192.168.71.82:2882:3882
server.3=192.168.71.82:2883:3883
Configuration of the zookeeper_02:
Datadir=/data/zookeeper/zookeeper_cluster_fake/zookeeper_02/data
Datalogdir=/data/zookeeper/zookeeper_cluster_fake/zookeeper_02/logs
clientport=2181
server.1=192.168.71.82:2881:3881
server.2=192.168.71.82:2882:3882
server.3=192.168.71.82:2883:3883
Configuration of the zookeeper_03:
Datadir=/data/zookeeper/zookeeper_cluster_fake/zookeeper_03/data
Datalogdir=/data/zookeeper/zookeeper_cluster_fake/zookeeper_03/logs
clientport=2181
server.1=192.168.71.82:2881:3881
server.2=192.168.71.82:2882:3882
server.3=192.168.71.82:2883:3883
7. Create a new myID file under data from the ZOOKEEPER_01,ZOOKEEPER_02 and zookeeper_03 three directories, respectively, with the contents of the numbers behind the SERVER.1,SERVER.2,SERVER.3.
Third, distributed mode
This can refer to my other article http://www.cnblogs.com/zengxiaoliang/p/6611364.html, here I will not say more.
Linux System Zookeeper Environment (stand-alone, pseudo-distributed, distributed)