您现在的位置是:首页 > 技术人生 > 服务器相关服务器相关
Ubuntu 20.04 安装zookeeper 3.5.9 集群
高晓波2021-09-22【服务器相关】人已围观
简介安装zookeeper的三台机器分别为vm-10、vm-11、vm-12,已设置相应host文件。
1、下载zookeeper 3.5.9cd /usr/local/src/sudo wget https://archive.apache.org/dist/zookeepe
安装zookeeper的三台机器分别为vm-10、vm-11、vm-12,已设置相应host文件。
1、下载zookeeper 3.5.9
2、解压
3、设置配置文件
(1)复制一份默认配置,改为zoo.cfg
(2)修改zoo.cfg
5、每台机器逐一启动zookeeper
查看状态
可以看到vm-11这台主机被选举为leader,其他两台为follower。
1、下载zookeeper 3.5.9
cd /usr/local/src/
sudo wget https://archive.apache.org/dist/zookeeper/zookeeper-3.5.9/apache-zookeeper-3.5.9-bin.tar.gz
2、解压
sudo tar -zxvf /usr/local/src/apache-zookeeper-3.5.9-bin.tar.gz -C /usr/local/
创建存储、日志文件夹
mkdir /usr/local/src/apache-zookeeper-3.5.9-bin/data
mkdir /usr/local/src/apache-zookeeper-3.5.9-bin/logs
3、设置配置文件
(1)复制一份默认配置,改为zoo.cfg
cp /usr/local/apache-zookeeper-3.5.9-bin/conf/zoo_sample.cfg /usr/local/apache-zookeeper-3.5.9-bin/conf/zoo.cfg
(2)修改zoo.cfg
vi /usr/local/apache-zookeeper-3.5.9-bin/conf/zoo.cfg
修改、添加配置
dataDir=/usr/local/apache-zookeeper-3.5.9-bin/data
dataLogDir=/usr/local/apache-zookeeper-3.5.9-bin/logs
#格式server.id,2888端口:集群内机器通讯使用(Leader监听此端口),3888端口:选举leader使用
server.1=vm-10:2888:3888
server.2=vm-11:2888:3888
server.3=vm-12:2888:3888
4、data目录下创建myid文件,myid文件中内容为当前server的id
touch /usr/local/src/apache-zookeeper-3.5.9-bin/data/myid
echo 1 > /usr/local/src/apache-zookeeper-3.5.9-bin/data/myid
5、每台机器逐一启动zookeeper
/usr/local/src/apache-zookeeper-3.5.9-bin/bin/zkServer.sh start
查看状态
/usr/local/apache-zookeeper-3.5.9-bin/bin/zkServer.sh status
vm-10:
hadoop@vm-10:~$ /usr/local/apache-zookeeper-3.5.9-bin/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.5.9-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: follower
vm-11:
hadoop@vm-11:~$ /usr/local/apache-zookeeper-3.5.9-bin/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.5.9-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: leader
vm-12:
hadoop@vm-12:~$ /usr/local/apache-zookeeper-3.5.9-bin/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/apache-zookeeper-3.5.9-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Mode: follower
可以看到vm-11这台主机被选举为leader,其他两台为follower。
Tags:zookeeper
很赞哦! ()
相关文章
随机图文
-
PVE添加自定义证书---U盘安装Proxmox VE(四)
PVE安装完毕后,打开web管理地址总是提示不安全,此时我们需要添加域名证书解决。 PVE添加自定义证书后台打开不怎么办? -
Centos7 mysql5.7.25 tar包解压安装
1、mysql官网下载mysql-5.7.25-el7-x86_64.tar.gz[root@centos7 src]# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.25-el7-x86_64.tar.gz 2、卸载系统 -
制作pve引导盘---U盘安装Proxmox VE(一)
年前搞了个星际蜗牛B款机箱,利用手头之前海淘dq77kb组装了个四盘位的Server。 -
Centos7 安装Jenkins--Jenkins使用(一)
本文介绍了centos7环境下通过yum方式安装Jenkins过程