My goal is to let the master server still be able to process write request while standby is in failure. I have noticed synchronous_commit =
can be manually set to off
and then reload the primary server.
Other configuration includes repmgr.conf
for repmgr
:
use_replication_slots=yes
Therefore the standby server created by repmgr
request the primary server to reserve wal-logs for it while it is in failure. Things goes not exactly as expected - I am able to commit writing operation to the primary and the standby is able to clone that from primary, but with a bug - the writing command always stuck here:
postgres=# CREATE DATABASE ANYTHING;
The prompt did not show up again until I pressed Ctrl
+D
, with these lines:
^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.
CREATE DATABASE
postgres=#
So it always ended up a freeze whenever I tried to write to the primary while its synchronous_commit = off
. (psql -c ...
will result in a freeze in shell too) This means this temporary change of replication setting does not reach my goal to prevent primary from a "strike" while standby encounters problem!
Is there a way to get around this freeze? Thanks.