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

zookeeper安装

root5年前 (2021-12-13)linux1463

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

分享给朋友:

相关文章

centos的新主机配置网络

centos的新主机配置网络

背景:公司因项目开发需要购置了两台主机。因为配置网络的大哥又是不在公司,但是又着急使用新主机。(旧的已经卡成狗腿了)急需解决问题,首先电脑刚插入网线又问题,不亮。只有一个网卡亮但是并不是Internet的网卡。其他四个网卡插入均不亮。换个网...

pycharm进行debug报错

pycharm进行debug报错

文件名不对,应该dubug模块有一个叫abc.py的文件换个名字正常运行...

contos yum install ** 提示没有可用软件包

yum install -y epel-release#添加一个epel的三方源,据说新大全在执行yum install ***...

shell获取当前文件路径

curPath=$(readlink -f "$(dirname "$0")") echo $curPath    #或者 curPath=$(dirname $(readli...

实用的linux命令

查看命令运行的实时结果watch  "ls |wc -l" 能够实时的监控命令执行的结果,不过刷新时间有点长,大概2秒,可以修改为1秒iftop查看出入网流量情况nload实时查看出入网流量情况fre...

Linux下查看系统版本信息

 Linux下如何查看版本信息, 包括位数、版本信息以及CPU内核信息、CPU具体型号等等,整个CPU信息一目了然。   1、# uname -a   (Linux查看版本当前操作系统内核信息)&nb...