Zookeeper安装配置(单机)

Zookeeper单机模式配置,非集群

​ 对外服务端口:2181

​ dataDir:/mnt/e/ZookeeperData

01.解压安装位置

/mnt/e/zookeeper-3.4.14

02.配置环境变量,添加内容:

#zookeeper
export ZOOKEEPER_HOME=/mnt/e/zookeeper-3.4.14
export PATH=$ZOOKEEPER_HOME/bin:$PATH

03.复制原有文件,生成一份新的cfg文件:

cp zoo_sample.cfg zoo.cfg

04.激活生效环境变量

(base) root@LAPTOP-P1LA53KS:/mnt/e# ls
'$RECYCLE.BIN'                       Scala-2.11.0                 docker-17.03.0-ce.tgz   postgis.tar                     zookeeper-3.4.14
 DeliveryOptimization               'System Volume Information'   hadoop-2.7.7            postgres.tar                    zookeeper-3.4.14.tar.gz
 Gadaite                             WindowsApps                  hadoop-2.7.7.tar.gz     scala-2.11.0.tgz                配置Jars
 Miniconda3-latest-Linux-x86_64.sh   WpSystem                     javawin                 spark-2.4.5-bin-hadoop2.7
'Program Files'                      conda-env                    jdk1.8-linux-64位       spark-2.4.5-bin-hadoop2.7.tgz
(base) root@LAPTOP-P1LA53KS:/mnt/e# cd zookeeper-3.4.14/
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# pwd
/mnt/e/zookeeper-3.4.14
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# ^C
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# vim /etc/profile
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# source /etc/profile
root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# vim /root/.bashrc
root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# source /root/.bashrc
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# pwd
/mnt/e/zookeeper-3.4.14
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# ls
LICENSE.txt  README_packaging.txt  conf        ivysettings.xml  src                       zookeeper-3.4.14.jar.md5   zookeeper-contrib  zookeeper-jute
NOTICE.txt   bin                   dist-maven  lib              zookeeper-3.4.14.jar      zookeeper-3.4.14.jar.sha1  zookeeper-docs     zookeeper-recipes
README.md    build.xml             ivy.xml     pom.xml          zookeeper-3.4.14.jar.asc  zookeeper-client           zookeeper-it       zookeeper-server
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# cd conf/
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# ls
configuration.xsl  log4j.properties  zoo_sample.cfg
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# cp zoo_sample.cfg zoo.cfg
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# ls
configuration.xsl  log4j.properties  zoo.cfg  zoo_sample.cfg

05.生成数据文件存放文件夹:

(base) root@LAPTOP-P1LA53KS:/mnt/e# mkdir ZookeeperData
(base) root@LAPTOP-P1LA53KS:/mnt/e# ls
'$RECYCLE.BIN'                       Scala-2.11.0                 conda-env               jdk1.8-linux-64位           spark-2.4.5-bin-hadoop2.7.tgz
 DeliveryOptimization               'System Volume Information'   docker-17.03.0-ce.tgz   postgis.tar                 zookeeper-3.4.14
 Gadaite                             WindowsApps                  hadoop-2.7.7            postgres.tar                zookeeper-3.4.14.tar.gz
 Miniconda3-latest-Linux-x86_64.sh   WpSystem                     hadoop-2.7.7.tar.gz     scala-2.11.0.tgz            配置Jars
'Program Files'                      ZookeeperData                javawin                 spark-2.4.5-bin-hadoop2.7
(base) root@LAPTOP-P1LA53KS:/mnt/e# cd ZookeeperData/
(base) root@LAPTOP-P1LA53KS:/mnt/e/ZookeeperData# pwd
/mnt/e/ZookeeperData

06.配置上面文件的文件夹,修改zoo.cfg文件的dataDir:

(base) root@LAPTOP-P1LA53KS:/mnt/e/ZookeeperData# cd $ZOOKEEPER_HOME
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# ls
LICENSE.txt  README_packaging.txt  conf        ivysettings.xml  src                       zookeeper-3.4.14.jar.md5   zookeeper-contrib  zookeeper-jute
NOTICE.txt   bin                   dist-maven  lib              zookeeper-3.4.14.jar      zookeeper-3.4.14.jar.sha1  zookeeper-docs     zookeeper-recipes
README.md    build.xml             ivy.xml     pom.xml          zookeeper-3.4.14.jar.asc  zookeeper-client           zookeeper-it       zookeeper-server
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# cd conf/
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# ls
configuration.xsl  log4j.properties  zoo.cfg  zoo_sample.cfg
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# vim zoo.cfg
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# cat zoo.cfg
# The number of milliseconds of each tick
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=/mnt/e/ZookeeperData
# the port at which the clients will connect
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
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf#

07.启动zookeeper,启动成功

(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# ls
configuration.xsl  log4j.properties  zoo.cfg  zoo_sample.cfg
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/conf# cd ..
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# ls
LICENSE.txt  README_packaging.txt  conf        ivysettings.xml  src                       zookeeper-3.4.14.jar.md5   zookeeper-contrib  zookeeper-jute
NOTICE.txt   bin                   dist-maven  lib              zookeeper-3.4.14.jar      zookeeper-3.4.14.jar.sha1  zookeeper-docs     zookeeper-recipes
README.md    build.xml             ivy.xml     pom.xml          zookeeper-3.4.14.jar.asc  zookeeper-client           zookeeper-it       zookeeper-server
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14# cd bin/
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/bin# ls
README.txt  zkCleanup.sh  zkCli.cmd  zkCli.sh  zkEnv.cmd  zkEnv.sh  zkServer.cmd  zkServer.sh  zkTxnLogToolkit.cmd  zkTxnLogToolkit.sh
(base) root@LAPTOP-P1LA53KS:/mnt/e/zookeeper-3.4.14/bin# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /mnt/e/zookeeper-3.4.14/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

你可能感兴趣的:(Linux环境,Kafka基础,zookeeper)