Note : This article is quoted from http://www.linuxidc.com/Linux/2016-09/135052.htm
The original text in the start zookeeper have some pits, the following has been treatise ~
1. Create/usr/local/services/zookeeper folder:
Mkdir-p/usr/local/services/zookeeper
2, into the/usr/local/services/zookeeper directory:
Cd/usr/local/services/zookeeper
3. Download 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/services/zookeeper/zookeeper-3.4.11 directory and create folders data and logs:
[Root@xinyi zookeeper]# cd zookeeper-3.4.11
[Root@xinyi zookeeper-3.4.11]# mkdir data
[Root@xinyi zookeeper-3.4.11]# mkdir Logs
6, into the/usr/local/services/zookeeper/zookeeper-3.4.11/conf directory,
And the Zoo_sample.cfg file is copied and named Zoo.cfg:
[Root@xinyi zookeeper-3.4.11]# cd conf/
[Root@xinyi conf]# CP zoo_sample.cfg zoo.cfg
7, with vim open zoo.cfg file and modify its contents as follows:
# Data folder
datadir=/usr/local/services/zookeeper/zookeeper-3.4.11/data
# log folder
datalogdir=/usr/local/ Services/zookeeper/zookeeper-3.4.11/logs
8. Save and close Zoo.cfg file:
9, into the/usr/local/services/zookeeper/zookeeper-3.4.11/bin directory:
[Root@xinyi zookeeper-3.4.11]# CD bin/
10, with vim open the/etc/directory profiles profile:
[Root@xinyi bin]# Vim/etc/profile
and append the following to its tail:
Export zookeeper_home=/usr/local/services/zookeeper/zookeeper-3.4.11/
export path= $ZOOKEEPER _home/bin: $PATH
Export PATH
11, so that the/etc/directory under the profile can be effective:
[Root@xinyi bin]# Source/etc/profile
12, Start zookeeper service:
[Root@xinyi bin]#./zkserver.sh start
zookeeper JMX enabled by default
Using config:/services/zookeeper/ zookeeper-3.4.11/bin/.. /conf/zoo.cfg
Starting Zookeeper ... Started
13, Query Zookeeper status:
[Root@xinyi bin]#./zkserver.sh status
zookeeper JMX enabled by default
Using config:/services/zookeeper/ zookeeper-3.4.11/bin/.. /conf/zoo.cfg
Mode:standalone
14, close the Zookeeper service:
[Root@xinyi bin]#./zkserver.sh Stop
If printing the following information indicates successful shutdown:
zookeeper JMX enabled by default
Using config:/ services/zookeeper/zookeeper-3.4.11/bin/.. /conf/zoo.cfg
Stopping zookeeper ... STOPPED
15, restart the Zookeeper service:
[Root@xinyi bin]#./zkserver.sh Restart
zookeeper JMX enabled by default
Using config:/services/zookeeper/ zookeeper-3.4.11/bin/.. /conf/zoo.cfg
zookeeper JMX enabled by default
Using config:/services/zookeeper/zookeeper-3.4.11/bin/. /conf/zoo.cfg
Stopping zookeeper ... no zookeeper to stop could R-3.4.11/data/zookeeper_server.pid)
Zookeeper JMX enabled by default
Using config:/services/zookeeper/ zookeeper-3.4.11/bin/.. /conf/zoo.cfg
Starting Zookeeper ... Started