1.安装zookeeper-3.4.6
cd /usr/soft
#解压zookeeper 安装包
tar -zvxf zookeeper-3.4.6
#拷贝安装包到安装目录
cp zookeeper-3.4.6 /mnt/zookeeper-3.4.6
#复制zookeeper 配置文件
cp /mnt/zookeeper-3.4.6/conf/zoo_sample.cfg /mnt/zookeeper-3.4.6/conf.zoo.cfg
#创建数据目录
mkdir /mnt/zookeeper-3.4.6/dataDir/zookeeper-data
#创建数据日志目录
mkdir /mnt/zookeeper-3.4.6/dataDir/logs
#创建myid 文件
cd /mnt/zookeeper-3.4.6/dataDir/zookeeper-data
touch myid
vi myid
1
#在/etc/profile文件中设置PATH
export ZOOKEEPER_HOME=/mnt/zookeeper-3.4.6/
PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
#修改/etc/hosts 内容
vi /etc/hosts
127.0.0.1 zookeeper
192.168.6.36 zookeeper2
192.168.6.36 zookeeper3
#修改配置文件内容
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/mnt/zookeeper-3.4.6/dataDir/zookeeper-data #数据目录,可以是任意目录
dataLogDir=/mnt/zookeeper-3.4.6/dataDir/logs
clientPort=2181 #监听client连接的端口号
server.1=zookeeper:2888:3888
server.2=zookeeper2:2888:3888
server.3=zookeeper3:2888:3888