作者简介
Hans-JürgenSchönig从90年代开始从事PostgreSQL相关工作。他是CYBERTEC的首席执行官兼技术主管,CYBERTEC是该领域的市场领导者之一,自2000年以来已为全球无数客户提供服务。
译者简介
孟令彬&崔鹏&海能达DBA团队,任职于海能达通信股份有限公司哈尔滨平台中心,数据库开发工程师,致力于postgresql数据库在专网通信领域、公共安全领域的应用与推广,个人兴趣主要集中在:数据库优化、高性能/高可用数据库架构设计与开源数据库的源码研究。
校对者简介
朱君鹏,博士研究生。主要研究方向为数据库管理系统,尤其是内存数据库、事务处理系统、软硬件协同设计、日志系统。
前言
vip-manager:自动IP故障转移

配置vip-manager很简单。这是一个例子:
# config for vip-manager by Cybertec PostgreSQL International GmbH# time (in milliseconds) after which vip-manager wakes up and checks# if it needs to register or release ip addresses.interval: 1000# the etcd or consul key which vip-manager will regularly poll.key: "/service/pgcluster/leader"# if the value of the above key matches the NodeName (often the hostname of this host),# vip-manager will try to add the virtual ip address to the interface specified in Ifacenodename: "pgcluster_member1"ip: 192.168.0.123 # the virtual ip address to managemask: 24 # netmask for the virtual ipiface: enp0s3 #interface to which the virtual ip will be added# how the virtual ip should be managed. we currently support "ip addr add/remove"# through shell commands or the Hetzner apihosting_type: basic # possible values: basic, or hetzner.endpoint_type: etcd # etcd or consul# a list that contains all endpoints to which etcd could talk.endpoints:- http://127.0.0.1:2379- http://192.168.0.42:2379# A single list-item is also fine.# consul will always only use the first entry from this list.# For consul, you'll obviously need to change the port to 8500. Unless you're# using a different one. Maybe you're a rebel and are running consul on port 2379?# Just to confuse people? Why would you do that? Oh, I get it.etcd_user: "patroni"etcd_password: "Julian's secret password"# don't worry about parameter with a prefix that doesn't match the endpoint_type.# You can write anything there, I won't even look at it.consul_token: "Julian's secret token"# how often things should be retried and how long to wait between retries.# (currently only affects arpClient)retry_num: 2retry_after: 250 #in milliseconds
基本上,配置很简单:首先,vip-manager必须知道etcd在哪里。然后,它必须知道在哪里可以找到领导者密钥(URL)。最后,我们想知道哪个IP必须绑定到哪个网络接口。剩下的是etcd或一些重试配置的简单登录信息。真正的核心是:etcd在哪里,如何登录?我的领导密钥在etcd中的哪个位置,以及哪个IP分配给哪个设备。那就是全部的魔力。
最后…
PostgreSQL中文社区欢迎广大技术人员投稿
投稿邮箱:press@postgres.cn
文章转载自PostgreSQL中文社区,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




