postgresql 高可用 patroni + etcd 之八 haproxy + keepalived

os: ubuntu 16.04
postgresql: 9.6.9
etcd: 3.2.18
patroni: 1.4.4
haproxy: 1.6.3
keepalived: 1.2.24

ip规划
192.168.56.101 node1 master
192.168.56.102 node2 slave
192.168.56.103 node3 slave
192.168.56.104 node4 slave
192.168.56.105 node5 slave

192.168.56.201 haproxy1 keepalived
192.168.56.202 haproxy2 keepalived

192.168.56.210 keepalived vip
192.168.56.211 keepalived vip

keepalived 是 ha 的一把利器,应用范围极广,这里主要用来对 haproxy 做高可用。关于 keepalived 的更多知识,可以自行baidu。

安装、配置好haproxy

haproxy1、haproxy2节点都需要做
详细过程略,参考上一篇blog

安装 keepalived

# apt install keepalived
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  ipvsadm libnl-route-3-200 libsensors4 libsnmp-base libsnmp30
Suggested packages:
  heartbeat ldirectord lm-sensors snmp-mibs-downloade

你可能感兴趣的:(postgresql,ha,patroni)