zookeeper安装

一、下载安装:

1、环境准备:

ZooKeeper服务器是用Java创建的,它运行在JVM之上。需要安装JDK 7或更高版本。

2、下载:

官网:Apache ZooKeeper

 

 3、安装:

 

创建安装目录

mkdir /opt/zookeeper

将文件上传到服务器

进入安装目录

cd /opt/zookeeper

解压压缩包

tar -zxvf apache-zookeeper-3.5.6-bin.tar.gz

复制并重命名解压文件

cp -r apache-zookeeper-3.5.6-bin zookeeper2181

 

4、配置启动

 

进入到conf目录拷贝一个zoo_sample.cfg并完成配置

 cd conf

#拷贝
cp  zoo_sample.cfg  zoo.cfg
 
修改zoo.cfg
vim 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=/tmp/zookeeper
# 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

进入编辑模式

a/i 

修改数据存放目录:

dataDir=/opt/zookeeper/zookeeper2181/zkdata

退出编辑模式:

esc键

保存退出:

:wq 回车

5.启动ZooKeeper

进入bin目录:

cd /opt/zookeeper/zookeeper2181/bin

 

 

启动:

./zkServer.sh start

 

 

查看状态:

./zkServer.sh status

 

 

posted @ 2022-07-20 14:30  hehehenhen  阅读(23)  评论(0)    收藏  举报