热门IT资讯网

【zookeeper】简单安装

发表于:2024-11-25 作者:热门IT资讯网编辑
编辑最后更新 2024年11月25日,1.关闭防火墙systemctl stop firewalld.servicesystemctl disable firewalld.service2.安装java# 卸载已有的jdkjava

1.关闭防火墙

systemctl stop    firewalld.servicesystemctl disable firewalld.service


2.安装java

# 卸载已有的jdkjava -versionrpm -qa |grep jdkyum -y remove java# 安装同一版本的jdkrz (jdk-8u144-linux-x64.rpm)rpm  -ivh jdk-8u144-linux-x64.rpmjava -version


3.安装zookeeper

下载地址 : http://zookeeper.apache.org/releases.html

tar zxvf zookeeper-3.4.10.tar.gzmv  zookeeper-3.4.10 /usr/local/zookeepercd /usr/local/zookeepermkdir datacd /usr/local/zookeeper/confcp -a zoo_sample.cfg zoo.cfg vim zoo.cfg----------------tickTime=2000initLimit=10syncLimit=5dataDir=/usr/local/zookeeper/dataclientPort=2181----------------/usr/local/zookeeper/bin/zkServer.sh stop  # 停止ZooKeeper服务器/usr/local/zookeeper/bin/zkServer.sh start  # 启动ZooKeeper服务器----------------ZooKeeper JMX enabled by defaultUsing config: /usr/local/zookeeper/bin/../conf/zoo.cfgStarting 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]



0