zookeeper官网地址:http://zookeeper.apache.org/releases.html
下载安装方式
wget http://mirror.bit.edu.cn/apache/zookeeper/stable/zookeeper-3.4.12.tar.gz
由于要安装在远程服务器上,故采用第一种方式安装;
注意:要下载源码包,否则启动客户端是启动失败;后缀带-bin.tar.gz
启动报错如下:
ZooKeeper JMX enabled by default Using config: /opt/software/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... FAILED TO START
看下zookeeper日志文件具体报错信息:
错误: 找不到或无法加载主类 org.apache.zookeeper.ZooKeeperMain
tar -zxvf apache-zookeeper-3.5.9.tar.gz
重命名:mv apache-zookeeper-3.5.9 zookeeper
mkdir dataDir
和mkdir dataLogDir
cp zoo_sample.cfg zoo.cfg
/opt/software/zookeeper/dataLogDir
vim /etc/profile
#ZOOKEEPER_HOME
export ZOOKEEPER_HOME=/opt/software/zookeeper
export PATH=$ZOOKEEPER_HOME/bin:$PATH
3.重新加载配置:source /etc/profile
./zkServer.sh start
./zkServer.sh stop
./zkServer.sh status