"repmgr standby clone": add --dry-run option

This commit is contained in:
Ian Barwick
2017-08-28 15:04:50 +09:00
parent e05bab8284
commit b900f9996f
2 changed files with 39 additions and 3 deletions

View File

@@ -256,9 +256,9 @@ Note that if a `conninfo` string is provided, values set in this will override a
provided as individual parameters. For example, with `-d 'host=foo' --host bar`, `foo`
will be chosen over `bar`.
Like other PostgreSQL utilities, `repmgr` will default to any values set in environment
variables if explicit command line parameters are not provided. See the PostgreSQL
documentation for further details:
Like other PostgreSQL utilities based on `libpq`, `repmgr` will default to any values
set in environment variables if explicit command line parameters are not provided.
See the PostgreSQL documentation for further details:
https://www.postgresql.org/docs/current/static/libpq-envars.html
@@ -542,6 +542,28 @@ then start the server.
* * *
### Verify replication is functioning
Connect to the master server and execute:
repmgr=# SELECT * FROM pg_stat_replication;
-[ RECORD 1 ]----+------------------------------
pid | 7704
usesysid | 16384
usename | repmgr
application_name | node2
client_addr | 192.168.1.2
client_hostname |
client_port | 46196
backend_start | 2016-01-07 17:32:58.322373+09
backend_xmin |
state | streaming
sent_location | 0/3000220
write_location | 0/3000220
flush_location | 0/3000220
replay_location | 0/3000220
sync_priority | 0
sync_state | async
Performing a switchover with repmgr
-----------------------------------

View File

@@ -303,6 +303,19 @@ do_standby_clone(void)
}
}
if (runtime_options.dry_run == true)
{
if (mode == pg_basebackup && runtime_options.fast_checkpoint == false)
{
log_info(_("consider using the -c/--fast-checkpoint option"));
}
log_info(_("all pre-requisites for \"standby clone\" are met"));
PQfinish(source_conn);
exit(ERR_BAD_CONFIG);
}
if (mode != barman)
{
initialise_direct_clone(&node_record);
@@ -4267,6 +4280,7 @@ do_standby_help(void)
" copy configuration files located outside the \n" \
" data directory to the same path on the standby (default) or to the\n" \
" PostgreSQL data directory\n"));
printf(_(" --dry-run perform checks but don't actually clone the standby\n"));
printf(_(" --no-upstream-connection when using Barman, do not connect to upstream node\n"));
printf(_(" --upstream-conninfo \"primary_conninfo\" value to write in recovery.conf\n" \
" when the intended upstream server does not yet exist\n"));