赞
踩
根据 zookeeper 官网部署操作,准备了三台 vmware 虚机,做一个集群环境
192.168.174.111 192.168.174.112 192.168.174.113
官网地址:https://zookeeper.apache.org/ 下载地址:https://zookeeper.apache.org/releases.html Apache ZooKeeper 3.8.0 Apache ZooKeeper 3.8.0(asc, sha512) Apache ZooKeeper 3.8.0 Source Release(asc, sha512) 点击:Apache ZooKeeper 3.8.0 Source Release ,选择下载 https://dlcdn.apache.org/zookeeper/zookeeper-3.8.0/apache-zookeeper-3.8.0.tar.gz 版本 上传地址: /root/tools 解压: tar -tar -zxvf zookeeper-3.8.0.tar.gz -C ~/training/ 设置环境变量: ZOOKEEPER_HOME=/root/training/zookeeper-3.8.0 export ZOOKEEPER_HOME PATH=$ZOOKEEPER_HOME/bin:$PATH export PATH 配置文件: conf/zoo.cfg dataDir=/root/training/zookeeper-3.8.0/zkData 建立数据目录: mkdir /root/training/zookeeper-3.8.0/zkData 启动: zkServer.sh start
3.5版本之后不自动生成jar包,启动或报错,缺失quotanum main类
Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain -------- 下载 -bin.xxx 带编译版本的 --------- 下载地址:https://zookeeper.apache.org/releases.html Apache ZooKeeper 3.8.0 选择下载:https://downloads.apache.org/zookeeper/zookeeper-3.8.0/apache-zookeeper-3.8.0-bin.tar.gz 按照上面的安装步骤重新配置一遍
集群配置参数
三台虚机都要配置 --- conf/zoo.cfg server.1=bigdata111:2888:3888 server.2=bigdata112:2888:3888 server.3=bigdata113:2888:3888 --- /etc/hosts 使用别名处理 192.168.174.111 bigdata111 192.168.174.112 bigdata112 192.168.174.113 bigdata113
systemctl status firewalld.service ---> 查看防火墙状态 systemctl stop firewalld.service ---> 如果重启,会重启防火墙 systemctl disable firewalld.service ---> 永久关闭防火墙
测试
三台启动: zkServer.sh start 查看状态: zkServer.sh status ---- 正常启动的状态 ----- [root@bigdata111 ~]# zkServer.sh status ZooKeeper JMX enabled by default Using config: /root/training/apache-zookeeper-3.8.0-bin/bin/../conf/zoo.cfg Client port found: 2181. Client address: localhost. Client SSL: false. Mode: follower 启动客户端: zkCli.sh --- 正常启动后查询 ---- [zk: localhost:2181(CONNECTED) 0] ls / [zookeeper] 到此可以愉快的玩耍了!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。