【发布时间】:2016-06-02 14:59:22
【问题描述】:
错误:
postgres=# insert into company values(4,'tom',21,'pune' ,21 );
^CCancel request sent
WARNING: canceling wait for synchronous replication due to user request
DETAIL: The transaction has already committed locally, but might not have been replicated to the standby.
INSERT 0 1
即使发生错误,它仍在主服务器上执行查询,并在从服务器上复制事务。
在大师上:
postgres=# SELECT pg_current_xlog_location();
pg_current_xlog_location
--------------------------
0/1900D0C0
(1 row)
在奴隶上:
postgres=# SELECT pg_last_xlog_receive_location();
pg_last_xlog_receive_location
-------------------------------
0/1900D0C0
(1 row)
从配置文件(由我设置)在 master 上设置的同步备用名称与我在 pg_stats_replication 表的记录中看到的 application_name 不同。许多解决方案都建议更改应用程序名称。但是,我不确定它从哪里将应用程序名称作为 master 上的 walreceiver。
在大师上:
postgres=# select application_name, sync_state from pg_stat_replication;
application_name | sync_state
------------------+------------
walreceiver | async
(1 row)
postgres=# show synchronous_standby_names;
synchronous_standby_names
---------------------------
slave1
(1 row)
postgres=# show synchronous_commit;
synchronous_commit
--------------------
on
(1 row)
我找到的解决方案之一是在我目前没有的路径“/var/lib/pgsql/9.2/data/”下创建表空间目录。我不确定该解决方案是否适用于 9.5 Postgresql。
对此的任何帮助表示赞赏。谢谢。
【问题讨论】:
标签: postgresql database-replication database-administration high-availability postgresql-9.5