1.下载&解压安装包
#下载解压zookeeperwget https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz#解压zookeepertar -zxvf apache-zookeeper-3.6.3-bin.tar.gz
2.修改配置文件
cp zoo_sample.cfg zoo.cfg#编辑zoo.cfg文件dataDir=/home/zk/data#客户端连接端口clientPort=2181#集群配置, host:操作内部通信端口:选举端口server.0=hadoop01:2888:3888server.1=hadoop02:2888:3888server.2=hadoop03:2888:3888
3.创建myid文件
#在dataDir=/home/zk/data文件下创建myid文件,并设置内容为0(在对应的节点下设置0/1/2)cd /home/zk/datavi myid
4.常用命令
#首先拷贝到其他节点,并修改对应的myid./zkServer.sh start./zkServer.sh stop./zkServer.sh restart./zkServer.sh status