环境安装备忘录 Zookeeper
1.1. 配置Zookeeper
- 建立zookeeper安装目录
mkdir /usr/local/zookeeper
- 将目录访问权限更改至tomcat用户下
chown -R -v tomcat /usr/local/zookeeper
- 解压缩zookeeper程序包
tar -xvf zookeeper-3.4.6.tar.gz
- Zookeeper环境配置
cp zoo_sample.cfg zoo.cfg
修改文件存储目录
dataDir=/usr/local/zookeeper/zookeeper-3.4.6/data
dataLogDir=/usr/local/zookeeper/zookeeper-3.4.6/logs
修改服务访问端口
clientPort=2181
配用户环境变量
export ZOOKEEPER_HOME=/usr/local/zookeeper/zookeeper-3.4.6
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
- Zookeepr集群环境
集群环境建立servieid 文件,每台服务器独立设置
echo "1" > /usr/local/zookeeper/zookeeper-3.4.6/data/myid
echo "2" > /usr/local/zookeeper/zookeeper-3.4.6/data/myid
配置文件调整zoo.conf,加入:
server.1=192.168.1.231:2310:2330
server.2=192.168.1.233:2310:2330
- Zookeepr启动与停止
启动:zkServer.sh start
查看状态:zkServer.sh status
停止:zkServer.sh stop
客户端链接:zkCli.sh -server 127.0.0.1:2181
- 更多参考
http://www.cnblogs.com/ilovexiao/p/3946547.html