1.关闭防火墙
systemctl stop firewalld.service systemctl disable firewalld.service
2.安装java
# 卸载已有的jdk java -version rpm -qa |grep jdk yum -y remove java # 安装同一版本的jdk rz (jdk-8u144-linux-x64.rpm) rpm -ivh jdk-8u144-linux-x64.rpm java -version
3.安装zookeeper
下载地址 : http://zookeeper.apache.org/releases.html
tar zxvf zookeeper-3.4.10.tar.gz mv zookeeper-3.4.10 /usr/local/zookeeper cd /usr/local/zookeeper mkdir data cd /usr/local/zookeeper/conf cp -a zoo_sample.cfg zoo.cfg vim zoo.cfg ---------------- tickTime=2000 initLimit=10 syncLimit=5 dataDir=/usr/local/zookeeper/data clientPort=2181 ---------------- /usr/local/zookeeper/bin/zkServer.sh stop # 停止ZooKeeper服务器 /usr/local/zookeeper/bin/zkServer.sh start # 启动ZooKeeper服务器 ---------------- ZooKeeper JMX enabled by default Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... STARTED ----------------
4.zookeeper客户端的使用(zkCli.sh)
/usr/local/zookeeper/bin/zkCli.sh # 直接进入localhost [zk: localhost:2181(CONNECTED) 0] /usr/local/zookeeper/bin/zkCli.sh -server 127.0.0.1:2181 # -server设定进入那个zookeeper [zk: 127.0.0.1:2181(CONNECTED) 0] # zookeeper里面都是绝对路径,没有相对路径 [zk: 127.0.0.1:2181(CONNECTED) 0] ls / # ls / 查看下初始化后的根目录 [zookeeper]
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/opensource/185641.html