I have a multi-node Postgres cluster running in High availability mode following the primary-standby
architecture.
postgres-0 5/5 Running 0 111s
postgres-1 5/5 Running 0 3m4s
postgres-monitor-0 4/4 Running 0 13m
One of the pod is primary
and the other pod is in standby
mode which gets replicated from primary
in a synchronous
manner, while standby remains in the read-only
mode.
I am running the following CRUD commands to update a local file:
-- Update pg_config to allow access to the users
create table hba ( lines text );
copy hba from '/pgsql/data/pg_hba.conf';
insert into hba (lines) values ('host all all 0.0.0.0/0 md5');
insert into hba (lines) values ('host all all ::/0 md5');
copy hba to '/pgsql/data/pg_hba.conf';
-- reload the config
select pg_reload_conf();
The issue is, the file /pgsql/data/pg_hba.conf
is getting updated on the primary
node and not on the standby
node (as all queries go to master), this means when the primary
node goes down and standby
becomes a new primary
the config changes will be missing.