1<refentry id="repmgr-node-service"> 2 <indexterm> 3 <primary>repmgr node service</primary> 4 </indexterm> 5 6 <refmeta> 7 <refentrytitle>repmgr node service</refentrytitle> 8 </refmeta> 9 10 <refnamediv> 11 <refname>repmgr node service</refname> 12 <refpurpose>show or execute the system service command to stop/start/restart/reload/promote a node</refpurpose> 13 </refnamediv> 14 15 16 <refsect1> 17 <title>Description</title> 18 <para> 19 Shows or executes the system service command to stop/start/restart/reload a node. 20 </para> 21 <para> 22 This command is mainly meant for internal &repmgr; usage, but is useful for 23 confirming the command configuration. 24 </para> 25 </refsect1> 26 27 <refsect1> 28 29 <title>Options</title> 30 31 <variablelist> 32 33 <varlistentry> 34 <term><option>--dry-run</option></term> 35 <listitem> 36 <para> 37 Log the steps which would be taken, including displaying the command which would be executed. 38 </para> 39 </listitem> 40 </varlistentry> 41 42 <varlistentry> 43 <term><option>--action</option></term> 44 <listitem> 45 <para> 46 The action to perform. One of <literal>start</literal>, <literal>stop</literal>, 47 <literal>restart</literal>, <literal>reload</literal> or <literal>promote</literal>. 48 </para> 49 <para> 50 If the parameter <option>--list-actions</option> is provided together with 51 <option>--action</option>, the command which would be executed will be printed. 52 </para> 53 </listitem> 54 </varlistentry> 55 56 57 <varlistentry> 58 <term><option>--list-actions</option></term> 59 <listitem> 60 <para> 61 List all configured commands. 62 </para> 63 <para> 64 If the parameter <option>--action</option> is provided together with 65 <option>--list-actions</option>, the command which would be executed for that 66 particular action will be printed. 67 </para> 68 </listitem> 69 </varlistentry> 70 71 72 <varlistentry> 73 <term><option>--checkpoint</option></term> 74 <listitem> 75 <para> 76 Issue a <command>CHECKPOINT</command> before stopping or restarting the node. 77 </para> 78 <para> 79 Note that a superuser connection is required to be able to execute the 80 <command>CHECKPOINT</command> command. 81 </para> 82 </listitem> 83 </varlistentry> 84 85 <varlistentry> 86 <term><option>-S</option>/<option>--superuser</option></term> 87 <listitem> 88 <para> 89 Connect as the named superuser instead of the normal &repmgr; user. 90 </para> 91 </listitem> 92 </varlistentry> 93 94 </variablelist> 95 96 </refsect1> 97 98 <refsect1> 99 <title>Exit codes</title> 100 <para> 101 One of the following exit codes will be emitted by <command>repmgr node service</command>: 102 </para> 103 <variablelist> 104 105 <varlistentry> 106 <term><option>SUCCESS (0)</option></term> 107 <listitem> 108 <para> 109 No issues were detected. 110 </para> 111 </listitem> 112 </varlistentry> 113 114 <varlistentry> 115 <term><option>ERR_LOCAL_COMMAND (5)</option></term> 116 <listitem> 117 <para> 118 Execution of the system service command failed. 119 </para> 120 </listitem> 121 </varlistentry> 122 123 </variablelist> 124 </refsect1> 125 126 <refsect1> 127 <title>Examples</title> 128 <para> 129 See what action would be taken for a restart: 130 <programlisting> 131[postgres@node1 ~]$ repmgr -f /etc/repmgr/12/repmgr.conf node service --action=restart --checkpoint --dry-run 132INFO: a CHECKPOINT would be issued here 133INFO: would execute server command "sudo service postgresql-12 restart"</programlisting> 134 </para> 135 136 <para> 137 Restart the PostgreSQL instance: 138 <programlisting> 139[postgres@node1 ~]$ repmgr -f /etc/repmgr/12/repmgr.conf node service --action=restart --checkpoint 140NOTICE: issuing CHECKPOINT 141DETAIL: executing server command "sudo service postgresql-12 restart" 142Redirecting to /bin/systemctl restart postgresql-12.service</programlisting> 143 </para> 144 145 <para> 146 List all commands: 147 <programlisting> 148[postgres@node1 ~]$ repmgr -f /etc/repmgr/12/repmgr.conf node service --list-actions 149Following commands would be executed for each action: 150 151 start: "sudo service postgresql-12 start" 152 stop: "sudo service postgresql-12 stop" 153 restart: "sudo service postgresql-12 restart" 154 reload: "sudo service postgresql-12 reload" 155 promote: "/usr/pgsql-12/bin/pg_ctl -w -D '/var/lib/pgsql/12/data' promote"</programlisting> 156 </para> 157 158 <para> 159 List a single command: 160 <programlisting> 161[postgres@node1 ~]$ repmgr -f /etc/repmgr/12/repmgr.conf node service --list-actions --action=promote 162/usr/pgsql-12/bin/pg_ctl -w -D '/var/lib/pgsql/12/data' promote </programlisting> 163 </para> 164 </refsect1> 165</refentry> 166