mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
node service: enable provision of the -S/--superuser option
This is required to be able to execute a CHECKPOINT if the normal repmgr user is not a superuser.
This commit is contained in:
@@ -75,8 +75,22 @@
|
|||||||
<para>
|
<para>
|
||||||
Issue a <command>CHECKPOINT</command> before stopping or restarting the node.
|
Issue a <command>CHECKPOINT</command> before stopping or restarting the node.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
Note that a superuser connection is required to be able to execute the
|
||||||
|
<command>CHECKPOINT</command> command.
|
||||||
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>-S</option>/<option>--superuser</option></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Connect as the named superuser instead of the normal &repmgr; user.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|||||||
@@ -2028,10 +2028,44 @@ do_node_service(void)
|
|||||||
{
|
{
|
||||||
PGconn *conn = NULL;
|
PGconn *conn = NULL;
|
||||||
|
|
||||||
if (strlen(config_file_options.conninfo))
|
if (config_file_options.conninfo[0] != '\0')
|
||||||
conn = establish_db_connection(config_file_options.conninfo, true);
|
{
|
||||||
|
t_conninfo_param_list node_conninfo = T_CONNINFO_PARAM_LIST_INITIALIZER;
|
||||||
|
char *errmsg = NULL;
|
||||||
|
bool parse_success = false;
|
||||||
|
|
||||||
|
initialize_conninfo_params(&node_conninfo, false);
|
||||||
|
|
||||||
|
parse_success = parse_conninfo_string(config_file_options.conninfo,
|
||||||
|
&node_conninfo,
|
||||||
|
&errmsg, false);
|
||||||
|
|
||||||
|
if (parse_success == false)
|
||||||
|
{
|
||||||
|
log_error(_("unable to parse conninfo string \"%s\" for local node"),
|
||||||
|
config_file_options.conninfo);
|
||||||
|
log_detail("%s", errmsg);
|
||||||
|
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If --superuser option provided, attempt to connect as the specified user
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (runtime_options.superuser[0] != '\0')
|
||||||
|
{
|
||||||
|
param_set(&node_conninfo,
|
||||||
|
"user",
|
||||||
|
runtime_options.superuser);
|
||||||
|
}
|
||||||
|
|
||||||
|
conn = establish_db_connection_by_params(&node_conninfo, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
conn = establish_db_connection_by_params(&source_conninfo, true);
|
conn = establish_db_connection_by_params(&source_conninfo, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (is_superuser_connection(conn, NULL) == false)
|
if (is_superuser_connection(conn, NULL) == false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1692,6 +1692,7 @@ check_cli_parameters(const int action)
|
|||||||
{
|
{
|
||||||
case STANDBY_CLONE:
|
case STANDBY_CLONE:
|
||||||
case NODE_CHECK:
|
case NODE_CHECK:
|
||||||
|
case NODE_SERVICE:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
item_list_append_format(&cli_warnings,
|
item_list_append_format(&cli_warnings,
|
||||||
|
|||||||
Reference in New Issue
Block a user