赞
踩
准备一台linux服务器
ZooKeeper服务器是用Java创建的,它运行在JVM之上。需要安装JDK 7或更高版本。
我测试安装的jdk1.8
apache-zookeeper-3.6.4-bin.tar.gz
#根目录创建 /soft
mkdir soft
#使用终端工具把下载的zookeeper安装包上传到服务器上 /soft 目录下
将tar包解压到/usr/local/目录下
tar -zxvf apache-zookeeper-3.6.4-bin.tar.gz -C /usr/local/
进入到conf目录拷贝一个zoo_sample.cfg并完成配置
#进入到conf目录
[root@rhel local]# cd /usr/local/apache-zookeeper-3.6.4-bin/conf
#拷贝
cp zoo_sample.cfg zoo.cfg
#打开目录
[root@rhel local]# cd /usr/local/apache-zookeeper-3.6.4-bin
#创建zooKeeper存储目录
[root@rhel apache-zookeeper-3.6.4-bin]# mkdir zkdata
#修改zoo.cfg
vim /opt/zooKeeper/apache-zooKeeper-3.5.6-bin/conf/zoo.cfg
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/apache-zookeeper-3.6.4-bin/zkdata
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
#修改存储目录:dataDir=/usr/local/apache-zookeeper-3.6.4-bin/zkdata
cd /opt/zooKeeper/apache-zooKeeper-3.5.6-bin/bin/
./zkServer.sh start
#启动
[root@rhel bin]# ./zkServer.sh start
#启动成功 Starting zookeeper ... STARTED
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.6.4-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
#查看zookeeper状态 standalone代表zk没有搭建集群,现在是单节点
[root@rhel bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.6.4-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: standalone
zookeeper的安装在RedHat与CentOS、ubuntu 等Linux系统下的安装基本相同,我是在redhat系统中操作的,安装步骤做个记录,仅供参考。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。