We have two servers (master, slave) and we want to use the FDW. The two databases to be connected with the FDW are both on the master (and the slave of course). When we are to CREATE SERVER
we would run something like:
CREATE SERVER server_db2 FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'master', dbname 'db2', port '5432');
The question is this: Does the slave create the server_db2
and connects to the master's IP address? What will happen if I break the relationship and the slave is promoted to master? I suppose it will be looking for the master to connect right?
Would connecting via 127.0.0.1 and setting the method to something other than trust
be a safe option?
In general the behavior of the postgres_fdw
is unclear to me in a replicated environment.