准备工作,安装JDK:https://www.cnblogs.com/javasl/p/11154205.html
1、解压文件到指定目录
tar -zxf zookeeper-3.4.6.tar.gz -C /usr/local/myroom
2、配置环境变量,将下面两句export添加到文件的最后
vi /etc/profile
export ZOOKEEPER_HOME=/usr/local/myroom/zookeeper-3.4.6 export PATH=$PATH:$ZOOKEEPER_HOME/bin
source /etc/profile(执行这一句,使配置文件立即生效)
3、修改配置文件
cd /usr/local/myroom/zookeeper-3.4.6/conf cp zoo_sample.cfg zoo.cfg
mkdir /usr/local/myroom/zookeeper-3.4.6/tmp
vi zoo.cfg
dataDir=/usr/local/myroom/zookeeper-3.4.6/tmp server.1=192.168.23.151:2888:3888
说明:server的id是1,tmp是新建的目录,存放数据文件;通信端口是2888,选举端口是3888,在tmp中新建文件myid
make /usr/local/myroom/zookeeper-3.4.6/tmp/myid (该文件中内容只有一个字符:1)
4、启动服务
zkServer.sh start 启动服务
zkServer.sh status 查看服务状态
zkServer.sh stop 停止服务
zkCli.sh 客户端连接
标签:tmp,单机版,local,zookeeper,3.4,myroom,安装,usr From: https://www.cnblogs.com/javasl/p/16630327.html