mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 08:06:29 +00:00
Update documentation and --help output for witness register
This completes the implementation of GitHub #186
This commit is contained in:
6
HISTORY
6
HISTORY
@@ -1,11 +1,11 @@
|
|||||||
3.2 2016-
|
3.2 2016-
|
||||||
repmgr: suppress connection error display in `repmgr cluster show`
|
repmgr: suppress connection error display in `repmgr cluster show`
|
||||||
unless `--verbose` supplied (Ian)
|
unless `--verbose` supplied (Ian)
|
||||||
|
repmgr: add commands `witness register` and `witness unregister` (Ian)
|
||||||
|
repmgr: enable `standby unregister` / `witness unregister` to be
|
||||||
|
executed for a node which is not running (Ian)
|
||||||
repmgr: remove deprecated command line options --initdb-no-pwprompt and
|
repmgr: remove deprecated command line options --initdb-no-pwprompt and
|
||||||
-l/--local-port (Ian)
|
-l/--local-port (Ian)
|
||||||
repmgr: add command `witness unregister`
|
|
||||||
repmgr: enable `standby unregister` / `witness unregister` to be
|
|
||||||
executed for a node which is not running
|
|
||||||
|
|
||||||
3.1.4 2016-07-12
|
3.1.4 2016-07-12
|
||||||
repmgr: new configuration option for setting "restore_command"
|
repmgr: new configuration option for setting "restore_command"
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -1170,6 +1170,8 @@ makes sense to create a witness server in conjunction with running
|
|||||||
`repmgrd`; the witness server will require its own `repmgrd` instance.
|
`repmgrd`; the witness server will require its own `repmgrd` instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
repmgrd and cascading replication
|
repmgrd and cascading replication
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
@@ -1241,7 +1243,8 @@ The following event types are available:
|
|||||||
* `standby_follow`
|
* `standby_follow`
|
||||||
* `standby_switchover`
|
* `standby_switchover`
|
||||||
* `witness_create`
|
* `witness_create`
|
||||||
* `witness_create`
|
* `witness_register`
|
||||||
|
* `witness_unregister`
|
||||||
* `repmgrd_start`
|
* `repmgrd_start`
|
||||||
* `repmgrd_shutdown`
|
* `repmgrd_shutdown`
|
||||||
* `repmgrd_failover_promote`
|
* `repmgrd_failover_promote`
|
||||||
@@ -1386,12 +1389,26 @@ which contains connection details for the local database.
|
|||||||
|
|
||||||
This command also requires the location of the witness server's data
|
This command also requires the location of the witness server's data
|
||||||
directory to be provided (`-D/--datadir`) as well as valid connection
|
directory to be provided (`-D/--datadir`) as well as valid connection
|
||||||
parameters for the master server.
|
parameters for the master server. If not explicitly provided,
|
||||||
|
database and user names will be extracted from the `conninfo` string in
|
||||||
|
`repmgr.conf`.
|
||||||
|
|
||||||
By default this command will create a superuser and a repmgr user.
|
By default this command will create a superuser and a repmgr user.
|
||||||
The `repmgr` user name will be extracted from the `conninfo` string
|
The `repmgr` user name will be extracted from the `conninfo` string
|
||||||
in `repmgr.conf`.
|
in `repmgr.conf`.
|
||||||
|
|
||||||
|
* `witness register`
|
||||||
|
|
||||||
|
This will set up the witness server configuration, including the witness
|
||||||
|
server's copy of the `repmgr` meta database, on a running PostgreSQL
|
||||||
|
instance and register the witness server with the master. It requires
|
||||||
|
the same command line options as `witness create`.
|
||||||
|
|
||||||
|
* `witness unregister`
|
||||||
|
|
||||||
|
Removes the entry for a witness server from the `repl_nodes` table. This
|
||||||
|
command will not shut down the witness server or remove its data directory.
|
||||||
|
|
||||||
* `cluster show`
|
* `cluster show`
|
||||||
|
|
||||||
Displays information about each active node in the replication cluster. This
|
Displays information about each active node in the replication cluster. This
|
||||||
|
|||||||
24
repmgr.c
24
repmgr.c
@@ -4204,6 +4204,8 @@ do_witness_register(PGconn *masterconn)
|
|||||||
char repmgr_db[MAXLEN];
|
char repmgr_db[MAXLEN];
|
||||||
|
|
||||||
bool record_created;
|
bool record_created;
|
||||||
|
bool event_is_register = true;
|
||||||
|
char event_type[MAXLEN];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract the repmgr user and database names from the conninfo string
|
* Extract the repmgr user and database names from the conninfo string
|
||||||
@@ -4218,6 +4220,8 @@ do_witness_register(PGconn *masterconn)
|
|||||||
/* masterconn will only be set when called from do_witness_create() */
|
/* masterconn will only be set when called from do_witness_create() */
|
||||||
if (masterconn == NULL)
|
if (masterconn == NULL)
|
||||||
{
|
{
|
||||||
|
event_is_register = false;
|
||||||
|
|
||||||
masterconn = establish_db_connection_by_params((const char**)param_keywords, (const char**)param_values, false);
|
masterconn = establish_db_connection_by_params((const char**)param_keywords, (const char**)param_values, false);
|
||||||
|
|
||||||
if (PQstatus(masterconn) != CONNECTION_OK)
|
if (PQstatus(masterconn) != CONNECTION_OK)
|
||||||
@@ -4228,6 +4232,12 @@ do_witness_register(PGconn *masterconn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set the event type based on how we were called */
|
||||||
|
if (event_is_register == true)
|
||||||
|
strcpy(event_type, "witness_register");
|
||||||
|
else
|
||||||
|
strcpy(event_type, "witness_create");
|
||||||
|
|
||||||
/* establish a connection to the witness, and create the schema */
|
/* establish a connection to the witness, and create the schema */
|
||||||
witnessconn = establish_db_connection(options.conninfo, false);
|
witnessconn = establish_db_connection(options.conninfo, false);
|
||||||
|
|
||||||
@@ -4236,7 +4246,7 @@ do_witness_register(PGconn *masterconn)
|
|||||||
create_event_record(masterconn,
|
create_event_record(masterconn,
|
||||||
&options,
|
&options,
|
||||||
options.node,
|
options.node,
|
||||||
"witness_create",
|
event_type,
|
||||||
false,
|
false,
|
||||||
_("Unable to connect to witness server"));
|
_("Unable to connect to witness server"));
|
||||||
PQfinish(masterconn);
|
PQfinish(masterconn);
|
||||||
@@ -4253,7 +4263,7 @@ do_witness_register(PGconn *masterconn)
|
|||||||
create_event_record(masterconn,
|
create_event_record(masterconn,
|
||||||
&options,
|
&options,
|
||||||
options.node,
|
options.node,
|
||||||
"witness_create",
|
event_type,
|
||||||
false,
|
false,
|
||||||
_("Unable to create schema on witness"));
|
_("Unable to create schema on witness"));
|
||||||
PQfinish(masterconn);
|
PQfinish(masterconn);
|
||||||
@@ -4299,7 +4309,7 @@ do_witness_register(PGconn *masterconn)
|
|||||||
create_event_record(masterconn,
|
create_event_record(masterconn,
|
||||||
&options,
|
&options,
|
||||||
options.node,
|
options.node,
|
||||||
"witness_create",
|
event_type,
|
||||||
false,
|
false,
|
||||||
"Unable to create witness node record on master");
|
"Unable to create witness node record on master");
|
||||||
|
|
||||||
@@ -4314,7 +4324,7 @@ do_witness_register(PGconn *masterconn)
|
|||||||
create_event_record(masterconn,
|
create_event_record(masterconn,
|
||||||
&options,
|
&options,
|
||||||
options.node,
|
options.node,
|
||||||
"witness_create",
|
event_type,
|
||||||
false,
|
false,
|
||||||
_("Unable to copy configuration from master"));
|
_("Unable to copy configuration from master"));
|
||||||
|
|
||||||
@@ -4359,7 +4369,7 @@ do_witness_register(PGconn *masterconn)
|
|||||||
create_event_record(masterconn,
|
create_event_record(masterconn,
|
||||||
&options,
|
&options,
|
||||||
options.node,
|
options.node,
|
||||||
"witness_create",
|
event_type,
|
||||||
true,
|
true,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@@ -4467,7 +4477,7 @@ do_help(void)
|
|||||||
printf(_(" %s [OPTIONS] master register\n"), progname());
|
printf(_(" %s [OPTIONS] master register\n"), progname());
|
||||||
printf(_(" %s [OPTIONS] standby {register|unregister|clone|promote|follow|switchover}\n"),
|
printf(_(" %s [OPTIONS] standby {register|unregister|clone|promote|follow|switchover}\n"),
|
||||||
progname());
|
progname());
|
||||||
printf(_(" %s [OPTIONS] witness {create|unregister}\n"), progname());
|
printf(_(" %s [OPTIONS] witness {create|register|unregister}\n"), progname());
|
||||||
printf(_(" %s [OPTIONS] cluster {show|cleanup}\n"), progname());
|
printf(_(" %s [OPTIONS] cluster {show|cleanup}\n"), progname());
|
||||||
printf(_("\n"));
|
printf(_("\n"));
|
||||||
printf(_("General options:\n"));
|
printf(_("General options:\n"));
|
||||||
@@ -4514,7 +4524,6 @@ do_help(void)
|
|||||||
" optionally providing a path to the binary\n"));
|
" optionally providing a path to the binary\n"));
|
||||||
printf(_(" -k, --keep-history=VALUE (cluster cleanup) retain indicated number of days of history (default: 0)\n"));
|
printf(_(" -k, --keep-history=VALUE (cluster cleanup) retain indicated number of days of history (default: 0)\n"));
|
||||||
printf(_(" --csv (cluster show) output in CSV mode (0 = master, 1 = standby, -1 = down)\n"));
|
printf(_(" --csv (cluster show) output in CSV mode (0 = master, 1 = standby, -1 = down)\n"));
|
||||||
/* printf(_(" --initdb-no-pwprompt (witness server) no superuser password prompt during initdb\n"));*/
|
|
||||||
printf(_(" -P, --pwprompt (witness server) prompt for password when creating users\n"));
|
printf(_(" -P, --pwprompt (witness server) prompt for password when creating users\n"));
|
||||||
printf(_(" -S, --superuser=USERNAME (witness server) superuser username for witness database\n" \
|
printf(_(" -S, --superuser=USERNAME (witness server) superuser username for witness database\n" \
|
||||||
" (default: postgres)\n"));
|
" (default: postgres)\n"));
|
||||||
@@ -4530,6 +4539,7 @@ do_help(void)
|
|||||||
printf(_(" standby follow - makes standby follow a new master\n"));
|
printf(_(" standby follow - makes standby follow a new master\n"));
|
||||||
printf(_(" standby switchover - switch this standby with the current master\n"));
|
printf(_(" standby switchover - switch this standby with the current master\n"));
|
||||||
printf(_(" witness create - creates a new witness server\n"));
|
printf(_(" witness create - creates a new witness server\n"));
|
||||||
|
printf(_(" witness register - registers a witness server\n"));
|
||||||
printf(_(" witness unregister - unregisters a witness server\n"));
|
printf(_(" witness unregister - unregisters a witness server\n"));
|
||||||
printf(_(" cluster show - displays information about cluster nodes\n"));
|
printf(_(" cluster show - displays information about cluster nodes\n"));
|
||||||
printf(_(" cluster cleanup - prunes or truncates monitoring history\n" \
|
printf(_(" cluster cleanup - prunes or truncates monitoring history\n" \
|
||||||
|
|||||||
Reference in New Issue
Block a user