Zookeeper安装配置(单机)

本文档详细介绍了如何在单机模式下配置Zookeeper,包括设置对外服务端口为2181,定义dataDir为/mnt/e/ZookeeperData,配置环境变量,创建数据文件存放目录,修改zoo.cfg配置文件,最后成功启动Zookeeper服务。
摘要由CSDN通过智能技术生成

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值