First, pre-deployment preparation:
1. Download Zookeeper installation package: http://zookeeper.apache.org/releases.html The version i downloaded is zookeeper-3.4.9.
2. Put the downloaded zookeeper-3.4.9 package into the/OPT directory, as shown in the directory structure:
3. Create a new zookeeper directory under the/tmp directory and create a new data directory under the Zookeeper directory.
4. IP of three Linux systems:
ip1:10.43.98.6
ip2:10.43.98.8
ip3:10.43.98.18
5, installation jdk8: Download path: http://www.oracle.com/technetwork/java/javase/downloads/ Jdk8-downloads-2133151.html, I chose jdk-8u112-linux-i586.tar.gz (Linux x86).
Download down and copy to the/usr/java directory, then: TAR-ZXVF jdk-8u112-linux-i586.tar.gz After extracting the directory under a jdk1.8.0_111 file. The environment variables are then set by the Vi/etc/profile command:
Export java_home=/usr/java/jdk1.8.0_111
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin
II. deployment of Zookeeper cluster environment
1, the first is to configure the Zoo.cfg file:
The Zoo-sample.cfg file name under the/opt/zookeeper-3.4.9/conf directory is uniformly modified to zoo.cfg.
Then VI zoo.cfg. Modify the configuration information as follows:
which
INITLIMIT=10: The unit is a multiple of the tick value for the time-out period when the node was initially connected to the primary node.
Synclimit=5: The time-out period for the primary node to synchronize with the slave node, in multiples of the tick value.
Datadir=/tmp/zookeeper: The directory that is used to configure a fuzzy snapshot saved by the memory database. That is, the data folder you just created is in this directory. The file information is stored in the data directory.
clientport=2181: Indicates the port number that is being monitored by the server to which the client is connected, by default, 2181. The port number that zookeeper provides access to externally.
server.1=10.43.98.6:2888:3888
server.2=10.43.98.8:2888:3888
server.3=10.43.98.18:2888:3888
2. Create a new myID file in the data directory just created on three Linux machines and open the VI myid command.
Enter 1 on the 10.43.98.6 machine, save exit, enter 2 on the 10.43.98.8 machine, save exit, enter 3 on the 10.43.98.18 machine, save exit. The server1,2,3 here corresponds to the same.
3. Start Zookeeper:
The/cloud/zookeeper-3.4.5/bin directory is launched on 3 machines respectively.
[[email protected] bin]#./zkserver.sh start to launch.
./zkserver.sh Restart (restart)
./zkserver.sh status (View status)
./zkserver.sh Stop (OFF)
Fast deployment of zookeeper clusters in Linux environments