| pgBouncer | sets_to_follow | text | *1* | Comma separated list of sets to follow or 'all' to follow all sets
| pgBouncer | pool_mode | 'ro/rw' | *'rw'* | Select a read-only subscriber or the origin for read-write
| pgBouncer | pool_all_databases | boolean | *'false'* | If true uses wildcard for database name in pgbouncer.ini, false uses slony database
+| pgBouncer | auth_user | text | *''* | If set auth_user will be appended to conninfo written in [databases] section
| pgBouncer | only_follow_origins | boolean | *'false'* | If true pgbouncer will only be reconfigured and reloaded when sets move origin
| pgBouncer | status_file | text | *'/tmp/pgbouncer_follower_%mode.status'* | File used to store a hash depicting the state of the cluster
| pgBouncer | log_file | text | *'/tmp/pgbouncer_follower_%mode.log'* | Log file for the script
my $g_reload_command = "/etc/init.d/pgbouncer_%mode reload";
my $g_mode = 'rw';
my $g_all_databases=false;
+my $g_auth_user='';
my ($year, $month, $day, $hour, $min, $sec);
my $change_time;
my $g_host = hostname;
my $target_sets;
my $target_port = 5432;
my $target_is_origin;
+ my $target_auth = "";
if ($g_debug) {
printLogLn($g_logfile, "DEBUG: All databases = " . ($g_all_databases ? 'true' : 'false'));
}
+ if ($g_auth_user ne "") {
+ $target_auth = " auth_user=" . $g_auth_user;
+ }
+
if (open(INFILE, "<", $template)) {
if (open(OUTFILE, ">", $target)) {
print OUTFILE "# Configuration file autogenerated at " . getRuntime() . " from $template\n";
printLogLn ($g_logfile, "DEBUG: Configuration for " . ($target_is_origin ? "origin" : "subscriber") . " of sets $target_sets node #$target_node_id $target_host:$target_port");
}
if ($all_databases) {
- $_ =~ s/(\[databases\])/$1\n\* = host=$target_host port=$target_port/;
+ $_ =~ s/(\[databases\])/$1\n\* = host=$target_host port=$target_port$target_auth/;
}
else {
- $_ =~ s/(\[databases\])/$1\n$target_db = host=$target_host port=$target_port dbname=$target_db/;
+ $_ =~ s/(\[databases\])/$1\n$target_db = host=$target_host port=$target_port dbname=$target_db$target_auth/;
}
}
else {
COALESCE((? BETWEEN 1 AND extract(epoch from s.st_lag_time)),false) AS lag_exceeded
FROM x
LEFT JOIN $qw_clname.sl_status s ON s.st_received = x.no_id
+ WHERE x.no_conninfo != '<event pending>'
)
SELECT * FROM z
ORDER BY origin_sets, @(CASE WHEN (host ~ '^[0-9]{1,3}(.[0-9]{1,3}){3}\$') THEN host::inet ELSE '255.255.255.255'::inet END - ?::inet) ASC";
when(/\bpool_all_databases\b/i) {
$g_all_databases = checkBoolean($value);
}
+ when(/\bauth_user\b/i) {
+ $g_auth_user = $value;
+ }
when(/\bonly_follow_origins\b/i) {
$g_origins_only = checkBoolean($value);
}
# thus hosting all databases on the node. If false
# only the replicated database is hosted.
+auth_user= # If set auth_user will be appended to conninfo written
+ # in [databases] section.
+
status_file=/var/slony/pgbouncer_follower/pgbouncer_follower_%mode.status # File used to store tate of the cluster
log_file=/var/slony/pgbouncer_follower/pgbouncer_follower_%mode.log # Log for pool_follower script
pid_file=/var/run/pgbouncer_follower_%mode.pid # Pidfile for poll mode
# thus hosting all databases on the node. If false
# only the replicated database is hosted.
+auth_user= # If set auth_user will be appended to conninfo written
+ # in [databases] section.
+
status_file=/var/slony/pgbouncer_follower/pgbouncer_follower_%mode.status # File used to store tate of the cluster
log_file=/var/slony/pgbouncer_follower/pgbouncer_follower_%mode.log # Log for pool_follower script
pid_file=/var/run/pgbouncer_follower_%mode.pid # Pidfile for poll mode