Improve "witness register" documentation, help and logging

Make it clearer that a) the primary server's hostname is required,
and b) how to provide it.

Based on feedback provided in GitHub #529.
This commit is contained in:
Ian Barwick
2019-01-17 10:42:53 +09:00
parent 9f04a846ec
commit aa8547a219
3 changed files with 17 additions and 10 deletions

View File

@@ -23,14 +23,19 @@
use of the witness server with <application>repmgrd</application>. use of the witness server with <application>repmgrd</application>.
</para> </para>
<para> <para>
When executing <command>repmgr witness register</command>, connection information When executing <command>repmgr witness register</command>, database connection
for the cluster primary server must also be provided. &repmgr; will automatically information for the cluster primary server must also be provided.
use the <varname>user</varname> and <varname>dbname</varname> values defined
in the <varname>conninfo</varname> string defined in the witness node's
<filename>repmgr.conf</filename>, if these are not explicitly provided.
</para> </para>
<para> <para>
Execute with the <literal>--dry-run</literal> option to check what would happen In most cases it's only necessary to provide the primary's hostname with
the <option>-h</option>/<option>--hostname</option> option; &repmgr; will
automatically use the <varname>user</varname> and <varname>dbname</varname>
values defined in the <varname>conninfo</varname> string defined in the
witness node's <filename>repmgr.conf</filename>, unless these are explicitly
provided as command line options.
</para>
<para>
Execute with the <option>--dry-run</option> option to check what would happen
without actually registering the witness server. without actually registering the witness server.
</para> </para>
</refsect1> </refsect1>

View File

@@ -484,13 +484,15 @@ void do_witness_help(void)
printf(_("Usage:\n")); printf(_("Usage:\n"));
printf(_(" %s [OPTIONS] witness register\n"), progname()); printf(_(" %s [OPTIONS] witness register\n"), progname());
printf(_(" %s [OPTIONS] witness unregister\n"), progname()); printf(_(" %s [OPTIONS] witness unregister\n"), progname());
puts("");
printf(_("WITNESS REGISTER\n")); printf(_("WITNESS REGISTER\n"));
puts(""); puts("");
printf(_(" \"witness register\" registers a witness node.\n")); printf(_(" \"witness register\" registers a witness node.\n"));
puts(""); puts("");
printf(_(" Requires provision of connection information for the primary\n")); printf(_(" Requires provision of connection information for the primary node,\n"));
printf(_(" typically usually just the hostname.\n"));
puts(""); puts("");
printf(_(" -h/--hostname hostname of the primary node\n"));
printf(_(" --dry-run check prerequisites but don't make any changes\n")); printf(_(" --dry-run check prerequisites but don't make any changes\n"));
printf(_(" -F, --force overwrite an existing node record\n")); printf(_(" -F, --force overwrite an existing node record\n"));
puts(""); puts("");

View File

@@ -1409,7 +1409,7 @@ check_cli_parameters(const int action)
if (!runtime_options.host_param_provided) if (!runtime_options.host_param_provided)
{ {
item_list_append_format(&cli_errors, item_list_append_format(&cli_errors,
_("host name for the source node must be provided when executing %s"), _("host name for the source node must be provided with -h/--hostname when executing %s"),
action_name(action)); action_name(action));
} }
@@ -1466,7 +1466,7 @@ check_cli_parameters(const int action)
if (!runtime_options.host_param_provided) if (!runtime_options.host_param_provided)
{ {
item_list_append_format(&cli_errors, item_list_append_format(&cli_errors,
_("host name for the source node must be provided when executing %s"), _("host name for the source node must be provided with -h/--hostname when executing %s"),
action_name(action)); action_name(action));
} }
} }