-------Error--------------
postgres=# INSERT INTO said VALUES ('3954','Saiduzzaman');
^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=# exit
Reason
---In Primary--
postgres=# show synchronous_commit;
synchronous_commit
--------------------
on
(1 row)
postgres=#
postgres=# select * from pg_stat_replication ;
pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start
| backend_xmin | state | sent_location | write_location | flush_location | replay_location | sync_priority |
sync_state
-------+----------+---------+------------------+-----------------+-----------------+-------------+-----------------------
--------+--------------+-----------+---------------+----------------+----------------+-----------------+---------------+-
-----------
27148 | 16393 | repuser | walreceiver | 192.168.159.134 | | 40704 | 2017-12-05 01:03:43.09
7386-05 | | streaming | 0/23015F48 | 0/23015F48 | 0/23015F48 | 0/23015F48 | 0 |
async
(1 row)
postgres=#
postgres=# select application_name, sync_state from pg_stat_replication;
application_name | sync_state
------------------+------------
walreceiver | async
(1 row)
postgres=#
postgres=# show synchronous_standby_names;
synchronous_standby_names
---------------------------
pgslave001
(1 row)
---In Standby--
postgres=# show synchronous_commit;
synchronous_commit
--------------------
local
(1 row)
postgres=#
------Solution---------
Changing synchronous_standby_names to 'walreceiver' resolved the error.
[root@pg_primary data]# vi postgresql.conf
postgres=# INSERT INTO said VALUES ('3954','Saiduzzaman');
^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=# exit
Reason
---In Primary--
postgres=# show synchronous_commit;
synchronous_commit
--------------------
on
(1 row)
postgres=#
postgres=# select * from pg_stat_replication ;
pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start
| backend_xmin | state | sent_location | write_location | flush_location | replay_location | sync_priority |
sync_state
-------+----------+---------+------------------+-----------------+-----------------+-------------+-----------------------
--------+--------------+-----------+---------------+----------------+----------------+-----------------+---------------+-
-----------
27148 | 16393 | repuser | walreceiver | 192.168.159.134 | | 40704 | 2017-12-05 01:03:43.09
7386-05 | | streaming | 0/23015F48 | 0/23015F48 | 0/23015F48 | 0/23015F48 | 0 |
async
(1 row)
postgres=#
postgres=# select application_name, sync_state from pg_stat_replication;
application_name | sync_state
------------------+------------
walreceiver | async
(1 row)
postgres=#
postgres=# show synchronous_standby_names;
synchronous_standby_names
---------------------------
pgslave001
(1 row)
---In Standby--
postgres=# show synchronous_commit;
synchronous_commit
--------------------
local
(1 row)
postgres=#
------Solution---------
Changing synchronous_standby_names to 'walreceiver' resolved the error.
[root@pg_primary data]# vi postgresql.conf
#synchronous_standby_names = 'pgslave001'
synchronous_standby_names = 'walreceiver'
[root@pg_primary data]# systemctl stop postgresql-9.5.service
[root@pg_primary data]# systemctl start postgresql-9.5.service
[root@pg_primary data]# su - postgres
Last login: Tue Dec 5 01:04:46 EST 2017 on pts/0
-bash-4.2$ psql
psql (9.5.10)
Type "help" for help.
postgres=# INSERT INTO said VALUES ('3690','Nabiul');
INSERT 0 1
postgres=# INSERT INTO said VALUES ('3690','Nabiul');
INSERT 0 1
[root@pg_primary data]# systemctl start postgresql-9.5.service
[root@pg_primary data]# su - postgres
Last login: Tue Dec 5 01:04:46 EST 2017 on pts/0
-bash-4.2$ psql
psql (9.5.10)
Type "help" for help.
postgres=# INSERT INTO said VALUES ('3690','Nabiul');
INSERT 0 1
postgres=# INSERT INTO said VALUES ('3690','Nabiul');
INSERT 0 1
hi i want to postgres 14.1 replication asyncrounsly with docker. master and slave container
ReplyDelete