简体   繁体   English

postgresql 9.4高可用性拓扑

[英]postgresql 9.4 high availability topology

I currently have a master postgresql 9.4 server containing many databases on Ubuntu 14.04. 我目前在Ubuntu 14.04上有一个包含许多数据库的主PostgreSQL 9.4服务器。

I tried to use Barman to setup backup, but would like to set up streaming replica so that when the master goes down, I can promote the standby replica to be the new master. 我尝试使用Barman来设置备份,但想设置流复制副本,以便在主副本出现故障时可以将备用副本升级为新的副本副本。 I looked in to repmgr, but this will only produce a read-only hot standby server. 我查看了repmgr,但这只会产生一个只读的热备用服务器。 Does this mean I should go with multi-master solution if I want to promote standby to accept write transaction as well? 这是否意味着如果我也要提升待机状态以接受写入事务,就应该使用多主解决方案?

I am envision the system to be 我设想系统是

 M1 (master)  -------------via ???-------------- S1 (standby/another master)
   |                                                |
   |via Barman                                      | via Barman
   |                                                |
B1 (backup server#1)                            B2 (backup server#2)

Ideally, after the M1 goes down, I can promote S1 to be the new master and it can accept read/write transaction not just read-only. 理想情况下,在M1发生故障之后,我可以将S1提升为新的主服务器,并且它可以接受读/写事务,而不仅仅是只读。 Once we bring back M1, M1 can stays as standby but will streaming with S1. 一旦我们带回M1,M1可以保持待机状态,但将与S1流式传输。

Is postgres 9.4 BDR (Bi-Directional Replication) a good solution to stream between M1 and S1? postgres 9.4 BDR(双向复制)是在M1和S1之间进行流传输的好解决方案吗? Or is there any commercial product can do this? 还是有任何商业产品可以做到这一点?

I am not a DBA, and would really appreciate your opinions. 我不是DBA,非常感谢您的意见。

Thank you so much! 非常感谢!

It sounds like standard streaming replication is what you're after. 听起来您正在追求标准的流复制。

In this scenario, you have a single master that takes all the writes, and then one or more read-only replicas which you can split the reads across to reduce load on the master. 在这种情况下,您有一个负责所有写操作的主服务器,然后是一个或多个只读副本,您可以将这些读取拆分成多个副本以减少主服务器上的负载。

If anything happens to the master database server, you can promote one of the replicas to master. 如果主数据库服务器发生任何事情,您可以将其中一个副本提升为主数据库。 Once a replica has been promoted to a master database it can then be written to. 将副本提升到主数据库后,即可将其写入。

Check out http://www.slideshare.net/jkshah/py-pg-day2013harep for more info on how these setups work (skip ahead to slide 21 for the postgresql stuff) 查阅http://www.slideshare.net/jkshah/py-pg-day2013harep了解有关这些设置如何工作的更多信息(有关PostgreSQL的内容,请先跳至幻灯片21)

What you are looking for like a single master, multiple (may be 2) warm stand-by cluster. 您正在寻找的就像一个主服务器,多个(可能是2个)热备用群集。 One stand-by server can be promoted to master if the original one fails. 如果原来的一台备用服务器出现故障,则可以将其升级为主服务器。 And according to 9.4, streaming replication is supported. 根据9.4,支持流复制。

`M1 (master) ---> S1 (warm stand-by) ---> S2 ( cascading replication)`

But I would suggest to use both file and streaming based replication for the stand-by. 但是我建议同时使用基于文件的复制和基于流的复制。

Postgresql 9.4 has all above supported. Postgresql 9.4具有以上所有支持。 Check http://www.postgresql.org/docs/9.4/static/high-availability.html 检查http://www.postgresql.org/docs/9.4/static/high-availability.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM