ltcluster node service

ltcluster 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 ltcluster 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.

Note that a superuser connection is required to be able to execute the CHECKPOINT command.

-S/--superuser

Connect as the named superuser instead of the normal ltcluster user.

Exit codes

One of the following exit codes will be emitted by ltcluster 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:

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

Restart the LightDB instance:

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

List all commands:

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

    start: "sudo service lightdb-12 start"
     stop: "sudo service lightdb-12 stop"
  restart: "sudo service lightdb-12 restart"
   reload: "sudo service lightdb-12 reload"
  promote: "/usr/pgsql-12/bin/lt_ctl  -w -D '/var/lib/pgsql/12/data' promote"

List a single command:

[lightdb@node1 ~]$ ltcluster -f /etc/ltcluster/12/ltcluster.conf node service --list-actions --action=promote
/usr/pgsql-12/bin/lt_ctl  -w -D '/var/lib/pgsql/12/data' promote