-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
3.3.4
-
PHP 7.4.19, Postgres 13.2, phpBB 3.3.4
I recently added a hot-standby to my Postgres install with the ability to failover automatically if the primary goes down. Since each the primary and standby are on different servers and have different IP addresses/hostnames I updated the config.php file to have each host specified as a comma seperated list:
$dbhost = '192.168.0.X,192.168.0.Y';
However, this will connect to the first in the list no matter what, even if it has failed-over and is the standby, which doesn't work with phpBB. This can be fixed by editing the postgres.php driver and adding the "target_session_attrs=read-write" setting to the $connect_string variable, which will cause it to check each connection for the ability to write before returning the connection.