From 74c44a717864b36cf283a7903634108d13711483 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 28 Nov 2018 12:57:16 +0900 Subject: [PATCH] doc: document "repmgr node service" This was originally intended for internal use, but it's mentioned several times in the documentation and is useful for diagnostic purposes. --- doc/configuration-file-service-commands.sgml | 10 +- doc/filelist.sgml | 1 + doc/repmgr-node-service.sgml | 151 +++++++++++++++++++ doc/repmgr.sgml | 1 + doc/switchover.sgml | 9 +- repmgr-action-node.c | 1 + repmgr-client.c | 6 +- 7 files changed, 166 insertions(+), 13 deletions(-) create mode 100644 doc/repmgr-node-service.sgml diff --git a/doc/configuration-file-service-commands.sgml b/doc/configuration-file-service-commands.sgml index a4a693bd..69cdfabc 100644 --- a/doc/configuration-file-service-commands.sgml +++ b/doc/configuration-file-service-commands.sgml @@ -74,12 +74,12 @@ To confirm which command &repmgr; will execute for each action, use - repmgr node service --list --action=..., e.g.: + repmgr node service --list-actions --action=..., e.g.: - repmgr -f /etc/repmgr.conf node service --list --action=stop - repmgr -f /etc/repmgr.conf node service --list --action=start - repmgr -f /etc/repmgr.conf node service --list --action=restart - repmgr -f /etc/repmgr.conf node service --list --action=reload + repmgr -f /etc/repmgr.conf node service --list-actions --action=stop + repmgr -f /etc/repmgr.conf node service --list-actions --action=start + repmgr -f /etc/repmgr.conf node service --list-actions --action=restart + repmgr -f /etc/repmgr.conf node service --list-actions --action=reload diff --git a/doc/filelist.sgml b/doc/filelist.sgml index 1bb2e7f9..90657015 100644 --- a/doc/filelist.sgml +++ b/doc/filelist.sgml @@ -74,6 +74,7 @@ + diff --git a/doc/repmgr-node-service.sgml b/doc/repmgr-node-service.sgml new file mode 100644 index 00000000..5554ce2e --- /dev/null +++ b/doc/repmgr-node-service.sgml @@ -0,0 +1,151 @@ + + + repmgr node service + + + + repmgr node service + + + + 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 + + + + + + + + Log the steps which would be taken, including displaying the command which would be executed. + + + + + + + + + The action to perform. One of start, stop, + restart, reload or promote. + + + If the parameter is provided together with + , the command which would be executed will be printed. + + + + + + + + + + List all configured commands. + + + If the parameter is provided together with + , the command which would be executed for that + particular action will be printed. + + + + + + + + + + Issue a CHECKPOINT before stopping or restarting the node. + + + + + + + + + Exit codes + + Following exit codes can be emitted by repmgr node service: + + + + + + + + No issues were detected. + + + + + + + + + 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 + + + diff --git a/doc/repmgr.sgml b/doc/repmgr.sgml index 68903d2c..01472053 100644 --- a/doc/repmgr.sgml +++ b/doc/repmgr.sgml @@ -108,6 +108,7 @@ &repmgr-node-status; &repmgr-node-check; &repmgr-node-rejoin; + &repmgr-node-service; &repmgr-cluster-show; &repmgr-cluster-matrix; &repmgr-cluster-crosscheck; diff --git a/doc/switchover.sgml b/doc/switchover.sgml index 56683c93..754932c2 100644 --- a/doc/switchover.sgml +++ b/doc/switchover.sgml @@ -84,11 +84,12 @@ Double-check which commands will be used to stop/start/restart the current - primary; on the current primary execute: + primary; this can be done by e.g. executing repmgr node service + on the current primary: - repmgr -f /etc/repmgr.conf node service --list --action=stop - repmgr -f /etc/repmgr.conf node service --list --action=start - repmgr -f /etc/repmgr.conf node service --list --action=restart + repmgr -f /etc/repmgr.conf node service --list-actions --action=stop + repmgr -f /etc/repmgr.conf node service --list-actions --action=start + repmgr -f /etc/repmgr.conf node service --list-actions --action=restart diff --git a/repmgr-action-node.c b/repmgr-action-node.c index 2cdc78c0..90d183fd 100644 --- a/repmgr-action-node.c +++ b/repmgr-action-node.c @@ -2958,6 +2958,7 @@ do_node_help(void) printf(_(" --dry-run show what action would be performed, but don't execute it\n")); printf(_(" --action action to perform (one of \"start\", \"stop\", \"restart\" or \"reload\")\n")); printf(_(" --list-actions show what command would be performed for each action\n")); + printf(_(" --checkpoint issue a CHECKPOINT before stopping or restarting the node\n")); puts(""); diff --git a/repmgr-client.c b/repmgr-client.c index 267d6b6d..78ea5e1c 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -29,15 +29,13 @@ * * NODE STATUS * NODE CHECK + * NODE REJOIN + * NODE SERVICE * * DAEMON STATUS * DAEMON PAUSE * DAEMON UNPAUSE * - * For internal use: - * NODE REJOIN - * NODE SERVICE - * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by