Linux installation and Configuration zookeeper 3.4.11
The following is an outline of the article:
1.zookeeper Foundation Environment.
2.zookeeper Basic Configuration installation.
3.zookeeper Simple Operation command.
On the introduction of zookeeper, I recommend (https://www.cnblogs.com/wuxl360/p/5817471.html) This article has been introduced very clearly
This article system and use version Description:
1.CentOS 7 Virtual machine system.
2. JDK 1.8.x version. (jdk-8u144-linux-x64.tar.gz)
3.zookeeper 3.4.10 (zookeeper-3.4.10.tar.gz)
1.1 Installation jdk1.8.x
Because zookeeper relies on the installation of JDK, a jdk1.8 installation is required first.
1.1.1 Now create a new directory in the Linux environment, software
[Root@localhost/]# mkdir Software
1.1.2 Then go to the official website of Oracle Download jdk-8u144-linux-x64.tar.gz This package, specific everyone to download it. Put the downloaded package in the software directory.
[Root@localhost/]# cp/software/jdk-8u144-linux-x64.tar.gz/usr/local/
Eventually install jdk1.8 yourself, and then configure environment variables.
#vi/etc/profile
Add the following inside
Export java_home=/usr/local/jdk1.8.0
Export Java_bin=/usr/local/jdk1.8.0/bin
Export path= $PATH: $JAVA _home/bin
Exportclasspath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export Java_home java_bin PATH CLASSPATH
Let the/etc/profile file become effective immediately after modification, you can use the following command:
# . /etc/profile
Attention:. and/etc/profile have spaces.
Test the version of the JDK.
Java-version
2. Install Zookeeper
2.1 Download Address:
[Root@localhost/]# wget http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
After the download is complete, also migrate to/usr/local/this directory, and then the MV renamed to Zookeeper.tar.gz, the following is the specific procedure
1. Create/usr/local/zookeeper folder:
Mkdir-p/usr/local/zookeeper
2, into the/usr/local/zookeeper directory:
Cd/usr/local/zookeeper
3, download zookeeper-3.4.11.tar.gz:
wget http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
4, Decompression zookeeper-3.4.11.tar.gz:
TAR-ZXVF zookeeper-3.4.11.tar.gz
5, into the/usr/local/zookeeper/conf directory:
CD zookeeper/conf/
6, copy the Zoo_sample.cfg file and named for Zoo.cfg:
CP Zoo_sample.cfg Zoo.cfg
7, with vim open zoo.cfg file and modify its contents as follows:
# The number of milliseconds of each tick
# Zookeeper defined base time interval, in units: milliseconds
ticktime=2000
# The number of ticks that the initial
# Synchronization phase can take
initlimit=10
# The number of ticks that can pass between
# Sending a request and getting an acknowledgement
Synclimit=5
# The directory where the snapshot is stored.
# Don't use/tmp for storage,/tmp here is just
# example Sakes.
# Datadir=/tmp/zookeeper
# Data folder
Datadir=/usr/local/zookeeper/data
# Log folder (this version may not have this directory)
Datalogdir=/usr/local/zookeeper/logs
# The port at which the clients'll connect
# Client access to zookeeper port number
clientport=2181
# The maximum number of the client connections.
# Increase this if your need to handle more clients
#maxClientCnxns =60
#
# being sure to read the maintenance section of the
# Administrator Guide before turning on Autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in DataDir
#autopurge. snapretaincount=3
# Purge task interval in hours
# Set to ' 0 ' to disable Auto Purge feature
#autopurge. purgeinterval=1
8. Save and close Zoo.cfg file:
9, into the/usr/local/zookeeper/bin directory:
Cd.. /bin/
10, with vim open the/etc/directory profiles profile:
Vim/etc/profile
and append the following to its tail:
#zookeeper Config
Export zookeeper_home=/usr/local/zookeeper/
Export path= $ZOOKEEPER _home/bin: $PATH
Export PATH
11, so that the/etc/directory under the profile can be effective:
Source/etc/profile
12, Start zookeeper service:
zkserver.sh start
Printing the following information indicates successful startup:
Zookeeper JMX enabled by default
Using config:/usr/local/zookeeper/bin/. /conf/zoo.cfg
Starting zookeeper ... Started
13, Query Zookeeper status:
zkserver.sh status
14, close the Zookeeper service:
zkserver.sh stop
Printing the following information indicates successful shutdown:
Zookeeper JMX enabled by default
Using config:/usr/local/zookeeper/bin/. /conf/zoo.cfg
Stopping zookeeper ... STOPPED
15, restart the Zookeeper service:
zkserver.sh restart
Printing the following information indicates a successful reboot:
Zookeeper JMX enabled by default
Using config:/usr/local/zookeeper/bin/. /conf/zoo.cfg
Zookeeper JMX enabled by default
Using config:/usr/local/zookeeper/bin/. /conf/zoo.cfg
Stopping zookeeper ... STOPPED
Zookeeper JMX enabled by default
Using config:/usr/local/zookeeper/bin/. /conf/zoo.cfg
Starting zookeeper ... Started