repmgr node service

Name

repmgr node service -- show or execute the system service command to stop/start/restart/reload/promote a node

Description

Shows or executes the system service command to stop/start/restart/reload a node.

This command is mainly meant for internal repmgr usage, but is useful for confirming the command configuration.

Options

--dry-run

Log the steps which would be taken, including displaying the command which would be executed.

--action

The action to perform. One of start, stop, restart, reload or promote.

If the parameter --list-actions is provided together with --action, the command which would be executed will be printed.

--list-actions

List all configured commands.

If the parameter --action is provided together with --list-actions, the command which would be executed for that particular action will be printed.

--checkpoint

Issue a CHECKPOINT before stopping or restarting the node.

Exit codes

One of the following exit codes will be emitted by repmgr node service:

SUCCESS (0)

No issues were detected.

ERR_LOCAL_COMMAND (5)

Execution of the system service command failed.

Examples

See what action would be taken for a restart:

[postgres@node1 ~]$ repmgr -f /etc/repmgr/11/repmgr.conf node service --action=restart --checkpoint --dry-run
INFO: a CHECKPOINT would be issued here
INFO: would execute server command "sudo service postgresql-11 restart"

Restart the PostgreSQL instance:

[postgres@node1 ~]$ repmgr -f /etc/repmgr/11/repmgr.conf node service --action=restart --checkpoint
NOTICE: issuing CHECKPOINT
DETAIL: executing server command "sudo service postgresql-11 restart"
Redirecting to /bin/systemctl restart postgresql-11.service

List all commands:

[postgres@node1 ~]$ repmgr -f /etc/repmgr/11/repmgr.conf node service --list-actions
Following commands would be executed for each action:

    start: "sudo service postgresql-11 start"
     stop: "sudo service postgresql-11 stop"
  restart: "sudo service postgresql-11 restart"
   reload: "sudo service postgresql-11 reload"
  promote: "/usr/pgsql-11/bin/pg_ctl  -w -D '/var/lib/pgsql/11/data' promote"

List a single command:

[postgres@node1 ~]$ repmgr -f /etc/repmgr/11/repmgr.conf node service --list-actions --action=promote
/usr/pgsql-11/bin/pg_ctl  -w -D '/var/lib/pgsql/11/data' promote