ZooKeeper服务器是用Java创建的,它运行在JVM之上。需要安装JDK 7或更高版本。
将下载的ZooKeeper放到/opt/ZooKeeper目录下
#上传zookeeper alt+p put f:/setup/apache-zookeeper-3.5.6-bin.tar.gz #打开 opt目录 cd /opt #创建zooKeeper目录 mkdir zooKeeper #将zookeeper安装包移动到 /opt/zooKeeper mv apache-zookeeper-3.5.6-bin.tar.gz /opt/zookeeper/将tar包解压到/opt/zookeeper目录下
tar -zxvf apache-ZooKeeper-3.5.6-bin.tar.gz1、配置zoo.cfg
进入到conf目录拷贝一个zoo_sample.cfg并完成配置
#进入到conf目录 cd /opt/zooKeeper/apache-zooKeeper-3.5.6-bin/conf/ #拷贝 cp zoo_sample.cfg zoo.cfg修改zoo.cfg
#打开目录 cd /opt/zooKeeper/ #创建zooKeeper存储目录 mkdir zkdata #修改zoo.cfg vim /opt/zooKeeper/apache-zooKeeper-3.5.6-bin/conf/zoo.cfg修改存储目录:dataDir=/opt/zookeeper/zkdata
2、启动ZooKeeper
cd /opt/zooKeeper/apache-zooKeeper-3.5.6-bin/bin/ #启动 ./zkServer.sh start看到上图表示ZooKeeper成功启动
3、查看ZooKeeper状态
./zkServer.sh statuszookeeper启动成功。standalone代表zk没有搭建集群,现在是单节点
zookeeper没有启动