Introduction to Zookeeper
ZooKeeper is a distributed , open source distributed application coordination service, which provides functions including configuration maintenance, domain name service, distributed synchronization, group service, etc.
Single machine installation of Zookeeper
Preparation before installation
- Host planning, I use a virtual machine to install a centOS7 version of the system.
- Install JDK1.8 and above
Download Zookeeper
Official address: http://zookeeper.apache.org/
Download path: https://www.apache.org/dyn/closer.cgi/zookeeper/
The version I currently download is 3.4.14
Upload the downloaded installation package to the system
First create the app directory under /usr/local/
cd /usr/local/
mkdir app
cd app
Upload the zookeeper installation package to the app directory
rz command to select the installation package to upload
Install Zookeeper
- Unzip apache-zookeeper-3.4.14.tar.gz
tar -xvf zookeeper-3.4.14.tar.gz
- Create soft connection
ln -s zookeeper-3.4.14/ zookeeper
- Configure environment variables
vi etc/profile
Add the following content
export ZK_HOME=/usr/local/app/zookeeper
export PATH =$ZK_HOME/bin:$PATH
source /etc/profile
- Modify the zoo.cfg configuration file
cd /usr/local/app/zookeeper/conf
- Copy the zoo.cfg file
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg
Modify the following content:
#修改数据目录
dataDir=/usr/data/zookeeper
- Save the file
Note: If the data directory is not created, create the directory first
mkdir /usr/data/zookeepre -p
- Start Zookeeper
zkServer.sh start
- Check Zookeeper status
./zkServer.sh status
The following content is displayed:
ZooKeeper JMX enabled by default
Using config: /usr/local/app/zookeeper/bin/../conf/zoo.cfg
Mode: standalone
- View process
ps -ef | grep zookeeper
The above steps complete the Zookeeper stand-alone installation.