linux system to install zookeeper services
- 2020-12-18 01:59:10
- OfStack
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 ES15en-3.4.9.tar.gz:
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz
4. Unzip zookeeper-3.4.9.ES22en.gz:
tar -zxvf zookeeper-3.4.9.tar.gz
5, enter/usr local/services/zookeeper/zookeeper 3.4.9 / conf directory:
cd zookeeper-3.4.9/conf/
6. Copy the file es36EN_ES37en. cfg and name it zoo. cfg:
cp zoo_sample.cfg zoo.cfg
7. Open the file zoo.cfg with vim and modify its contents as follows:
# The number of milliseconds of each tick
# zookeeper The defined base time interval, in 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.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# dataDir=/tmp/zookeeper
# Data folder
dataDir=/usr/local/services/zookeeper/zookeeper-3.4.9/data
# Log folder
dataLogDir=/usr/local/services/zookeeper/zookeeper-3.4.9/logs
# the port at which the clients will connect
# Client access zookeeper The port number
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be 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 the zoo. cfg file:
9, into the/usr/local/services/zookeeper/zookeeper 3.4.9 / bin directory:
cd ../bin/
10. Use vim to open the configuration file profile in /etc/ directory:
vim /etc/profile
And appends the following to its tail:
# idea - zookeeper-3.4.9 config start - 2016-09-08
export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.9/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
# idea - zookeeper-3.4.9 config start - 2016-09-08
11. Make the profile file in /etc/ directory effective:
source /etc/profile
12. Start zookeeper Service:
zkServer.sh start
If the following information is printed, it indicates successful startup:
cd /usr/local/services/zookeeper
0
13. Query zookeeper status:
cd /usr/local/services/zookeeper
1
14. Shut down zookeeper service:
cd /usr/local/services/zookeeper
2
Successful shutdown is indicated if the following information is printed:
ZooKeeper JMX enabled by default
Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
15. Restart zookeeper service:
cd /usr/local/services/zookeeper
4
A successful restart is indicated by printing the following information:
cd /usr/local/services/zookeeper
5
conclusion