【发布时间】:2016-10-12 22:46:28
【问题描述】:
对 Postgresql 来说相当新,但必须设置复制。我选择了 BDR,它在本地演示中运行良好,但在分布式机器上开始出现问题,主要是因为我不知道我到底在做什么,我哭着睡着,渴望 MySQL。我已经让 BDR 在多台服务器上工作,几乎。当我跑步时:
SELECT bdr.bdr_node_join_wait_for_ready();
在它挂起的加入节点上。这在 DB2 和 DB3 上都会发生。 DB1 返回一个有效响应。研究这个我遇到了 bdr_init_copy 命令,它显然做了我一直在手工做的所有事情,然后是一些。所以尝试了一下。现在,当我跑步时:
/usr/lib/postgresql/9.4/bin/bdr_init_copy -d "host=192.168.1.10 dbname=demo3" --local-dbname="host=192.168.1.23 dbname=demo3" -n db2 -D bdr_data
我明白了
bdr_init_copy: starting ...
Getting remote server identification ...
Detected 2 BDR database(s) on remote server
Updating BDR configuration on the remote node:
demo2: creating replication slot ...
demo2: creating node entry for local node ...
demo3: creating replication slot ...
demo3: creating node entry for local node ...
Creating base backup of the remote node...
63655/63655 kB (100%), 1/1 tablespace
Creating restore point on remote node ...
Bringing local node to the restore point ...
它就在那里。我假设这两个问题的原因相同。据我所知,本地节点(db2)上没有创建日志条目,但远程(db1)上存在以下内容
2016-10-12 22:38:43 UTC [20808-1] postgres@demo2 LOG: logical decoding found consistent point at 0/5001F00
2016-10-12 22:38:43 UTC [20808-2] postgres@demo2 DETAIL: There are no running transactions.
2016-10-12 22:38:43 UTC [20808-3] postgres@demo2 STATEMENT: SELECT pg_create_logical_replication_slot('bdr_17163_6340711416785871202_2_17163__', 'bdr');
2016-10-12 22:38:43 UTC [20811-1] postgres@demo3 LOG: logical decoding found consistent point at 0/5002090
2016-10-12 22:38:43 UTC [20811-2] postgres@demo3 DETAIL: There are no running transactions.
2016-10-12 22:38:43 UTC [20811-3] postgres@demo3 STATEMENT: SELECT pg_create_logical_replication_slot('bdr_17939_6340711416785871202_2_17939__', 'bdr');
2016-10-12 22:38:44 UTC [20812-1] postgres@demo3 LOG: restore point "bdr_6340711416785871202" created at 0/50022A8
2016-10-12 22:38:44 UTC [20812-2] postgres@demo3 STATEMENT: SELECT pg_create_restore_point('bdr_6340711416785871202')
有什么帮助吗?
【问题讨论】:
-
在上游节点发出一个提交以确保 WAL 刷新超过还原点。顺便说一句,如果您通常不知道您在使用 Pg 做什么,则 BDR 不是一个可以使用的工具。您需要了解它施加的限制以及有效使用它所需的应用程序更改。请详细阅读文档。它不适合 PostgreSQL 的新用户。也许你应该只使用你所知道的?或者至少使用简单的 PostgreSQL 主动/备用复制和 repmgr?
-
同时检查你运行
bdr_init_copy的目录中的bdr_init_copy_postgres.log。
标签: postgresql replication postgresql-9.4 postgresql-bdr