第一章 概述
关于zookeeper和ETCD
ZooKeeper和etcd都是用于分布式系统中协调服务的开源工具,它们提供一致的键值存储来管理配置信息、服务发现、分布式同步等。ZooKeeper 提供了高性能的数据访问能力,适合需要快速读写的场景,并且拥有丰富的客户端库,支持多种编程语言。相比 ZooKeeper,etcd 是一个相对较新的项目,可能在某些方面不如 ZooKeeper 成熟,但是Etcd与容器编排工具如 Kubernetes 紧密集成,非常适合在容器化和微服务架构中使用。 总的来说,ZooKeeper还是etcd取决于具体需求。如果需要一个成熟、功能丰富且性能高的协调服务,或者在某些高吞吐量的场景下,ZooKeeper是一个不错的选择。而如果你的应用场景更倾向于容器化和微服务架构,etcd会更加适合。
第二章 服务器
集群的配置信息
主机名 |
ip地址 |
zookeeper1 |
192.168.23.152 |
zookeeper2 |
192.168.23.153 |
zookeeper3 |
192.168.23.154 |
vip |
192.168.23.85 |
第三章 部署流程
防火墙和SELinux设置
#永久设置SELinux
sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
getenforce
#关闭防火墙
systemctl disable firewalld
安装Zookeeper
#安装java环境
yum install java-11-openjdk-devel -y
#配置环境变量
vim /etc/profile
#添加行
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.23.0.9-2.el7_9.x86_64
export PATH=$JAVA_HOME/bin:$PATH
#下载并解压Zookeeper
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
tar -xf apache-zookeeper-3.8.4-bin.tar.gz
cd apache-zookeeper-3.8.4-bin
#创建数据目录和日志目录
mkdir /home/zookeeper
mkdir /home/zookeeper/log
#修改Zookeeper配置文件,设置如下参数
cp conf/zoo_sample.cfg conf/zoo.cfg
vim conf/zoo.cfg
vim /etc/patroni.yml
标签:bin,Zookeeper,Postgres,ZooKeeper,Patroni,zookeeper,192.168,apache,3.8 From: https://blog.csdn.net/2401_86666593/article/details/143205039# The number of milliseconds of each tick
tickTime=3000
# 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
forceSync=no
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/home/zookeeper/apache-zookeeper-3.8.4-bin
dataLogDir=/home/zookeeper/apache-zookeeper-3.8.4-bin/log
# the port at which the clients will connect
clientPort=2181
minSessionTimeout=16000
maxSessionTimeout=30000