【问题标题】:Cannot execute SQL query on streaming replication setup master server Postgresql 9.5无法在流复制设置主服务器 Postgresql 9.5 上执行 SQL 查询
【发布时间】: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


    【解决方案1】:

    synchronous_standby_names 更改为 'walreceiver' 解决了该错误。关注链接To know more about synchronous_standby_names

    【讨论】:

      猜你喜欢
      • 2016-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-27
      • 1970-01-01
      • 2021-12-20
      • 1970-01-01
      相关资源
      最近更新 更多