当前位置:首页 > linux > 正文内容

zookeeper安装

root2年前 (2021-12-13)linux499

Zookeeper 是一个分布式应用程序协调服务,主要用来写到分布式服务的上下线,主从问题,选举主节点等。

下载新版 zookeeper:apache-zookeeper-3.7.0-bin

1、解压后修改配置文件,进入 conf 目录,将 zoo_sample.cfg 复制为 zoo.cfg 后,修改配置内容:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/jqy/apps/apache-zookeeper-3.7.0-bin/zkdata
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
server.1=192.168.56.106:2888:3888
server.2=192.168.56.107:2888:3888
server.3=192.168.56.108:2888:3888

192.168.56.106 ip 以实际ip为准

dataDir 以实际的存储为准


2、在dataDir路径下创建myid文件

myid 文件内写入节点编号,192.168.56.106 机器写入 1, 192.168.56.107 机器写入 2, 192.168.56.108 机器写入 3.


3、启动 zookeeper。三台机器都配置完成后,分别在每台机器的 apache-zookeeper-3.7.0-bin 目录下执行 ./bin/zkServer.sh start,然会使用 ./bin/zkServer.sh status 查看是否启动成功


zookeeper有三个端口

2181、3888、2888

2181:对cline端提供服务

3888:选举leader使用

2888:集群内机器通讯使用(Leader监听此端口)

集群为大于等于3个基数,如 3、5、7....,不宜太多,集群机器多了选举和数据同步耗时时长长,不稳定。目前觉得,三台选举+N台observe很不错

扫描二维码推送至手机访问。

版权声明:本文由一叶知秋发布,如需转载请注明出处。

本文链接:https://zhiqiu.top/?id=177

分享给朋友:

相关文章

FTP主动模式和被动模式的区别

基础知识:  FTP只通过TCP连接,没有用于FTP的UDP组件.FTP不同于其他服务的是它使用了两个端口, 一个数据端口和一个命令端口(或称为控制端口)。通常21端口是命令端口,20端口是数据端口。当混入主动/被动模式的概念时,...

centos切勿执行yum -y update

yum update 跟apt-get update 不一样centos的yum update相当于ubuntu的apt upgrade如果想用ubuntu的apt update,centos是yum makecache因为执行yum -y...

修改linux时区

ubuntu:rm  /etc/localtimeln -sf /usr/share/zoneinfo/Asia/Shanghai  /etc/localtimecentos echo "A...

socat 做vp跳板 隐藏自己防溯源

socat 是linux 的一个工具,可以做端口映射,做到隐藏自己,深藏功与名ubuntu 安装apt-get install socatcentos 应该类是把  直接 yum install socat先写个自己常用到的代码s...

linux 服务器时间校准

Linux 时间矫正sudo ntpdate -u ntp.api.bz第一使用可能提示ntpdate没安装,用以下命令安装即可ubuntu系统sudo apt install ntpdatecent...

python安装的时候出现python setup.py egg_info Check the logs for full command output

python安装的时候出现python setup.py egg_info Check the logs for full command output

解决yum install python2-develpip install --upgrade setuptools...