简体   繁体   English

数据库镜像/Postgres 流复制

[英]Database Mirroring / Postgres Streaming Replication

I am not a DBA;我不是 DBA; I'm the primary developer of an enterprise database based application.我是基于企业数据库的应用程序的主要开发人员。

I'm currently specing out some new machines to upgrade our existing enterprise database.我目前正在寻找一些新机器来升级我们现有的企业数据库。 Currently we're running Postgres 8.4 with a database at our DR site that receives updates at intervals via some custom rsync work a former employee performed.目前,我们在 DR 站点上运行带有数据库的 Postgres 8.4,该数据库通过前雇员执行的一些自定义 rsync 工作定期接收更新。

One of the major issues we're trying to tackle is latency between two global offices.我们试图解决的主要问题之一是两个全球办事处之间的延迟。 We have staff in NY and staff in London.我们在纽约有员工,在伦敦有员工。 Currently, the London staffers suffer the fate of our VPN pipe.目前,伦敦员工遭受我们 VPN pipe 的命运。 I'm not really in a position to change that infrastructure.我并没有真正在 position 中更改该基础架构。

What I'd like to do is move to Postgres 9 and setup streaming replication.我想做的是迁移到 Postgres 9 并设置流复制。 The slave would be in the London office, which would alleviate read problems for users.奴隶将在伦敦办公室,这将减轻用户的阅读问题。 The problem I foresee is writes to the slave (not sure how PG handles this, my understanding is the slave is in read-only mode).我预见的问题是写入从机(不确定PG如何处理这个,我的理解是从机处于只读模式)。 Ideally, writes would be sent to the master in NY (writes are very infrequent from London, but necessary) by the database itself.理想情况下,写入将由数据库本身发送到纽约的主服务器(伦敦的写入非常罕见,但很有必要)。 Furthermore, I can setup fallover to have it act as a hot swappable backup (replacing the DR).此外,我可以设置故障转移以使其充当热插拔备份(替换 DR)。 Again, all contained within Postgres configuration with no additional code.同样,所有内容都包含在 Postgres 配置中,没有额外的代码。

That's my idealized solution.这是我理想化的解决方案。 How far off am I?我离我有多远? Is this at all possible?这是可能吗?

I'm a little overwhelmed by the breadth of this topic and Google is not really helping me.我对这个主题的广度有点不知所措,谷歌并没有真正帮助我。 I would appreciate any advice from some experienced DBAs, with anecdotes, relevant documentation or examples.我会感谢一些经验丰富的 DBA 提供的任何建议,包括轶事、相关文档或示例。

Currently we're using SQLAlchemy as the primary interface to the database, if that's relevant.目前我们正在使用 SQLAlchemy 作为数据库的主要接口,如果相关的话。 It does mean we're not tied to Postgres.这确实意味着我们不依赖于 Postgres。

Thanks everyone.感谢大家。

pgpool-II can handle this for your: pgpool-II可以为您处理:在此处输入图像描述

Check this example .检查这个例子

The PostgreSQL 9 documentation gives a nice overview of the options available. PostgreSQL 9 文档很好地概述了可用选项。

http://www.postgresql.org/docs/9.0/static/different-replication-solutions.html http://www.postgresql.org/docs/9.0/static/different-replication-solutions.html

You might want to look at Slony if you do not mind having to write to the master and not the slave, or if you want, check out any of the multi-master replication technologies available.如果您不介意写入主服务器而不是从服务器,或者如果您愿意,可以查看 Slony,查看任何可用的多主复制技术。

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

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