1<refentry id="repmgr-service-status">
2  <indexterm>
3    <primary>repmgr service status</primary>
4  </indexterm>
5
6  <indexterm>
7    <primary>repmgrd</primary>
8    <secondary>displaying service status</secondary>
9  </indexterm>
10
11  <refmeta>
12    <refentrytitle>repmgr service status</refentrytitle>
13  </refmeta>
14
15  <refnamediv>
16    <refname>repmgr service status</refname>
17    <refpurpose>display information about the status of &repmgrd; on each node in the cluster</refpurpose>
18  </refnamediv>
19
20  <refsect1>
21    <title>Description</title>
22    <para>
23      This command provides an overview over all active nodes in the cluster and the state
24      of each node's &repmgrd; instance. It can be used to check
25      the result of <xref linkend="repmgr-service-pause"/> and <xref linkend="repmgr-service-unpause"/>
26      operations.
27    </para>
28  </refsect1>
29
30  <refsect1>
31    <title>Prerequisites</title>
32    <para>
33      PostgreSQL should be accessible on all nodes (using the <varname>conninfo</varname> string shown by
34      <link linkend="repmgr-cluster-show"><command>repmgr cluster show</command></link>)
35      from the node where <command>repmgr service status</command> is executed.
36    </para>
37  </refsect1>
38
39  <refsect1>
40    <title>Execution</title>
41    <para>
42      <command>repmgr service status</command> can be executed on any active node in the
43      replication cluster. A valid <filename>repmgr.conf</filename> file is required.
44    </para>
45    <para>
46      If a node is not accessible, or PostgreSQL itself is not running on the node,
47      &repmgr; will not be able to determine the status of that node's &repmgrd; instance,
48      and &quot;<literal>n/a</literal>&quot; will be displayed in the node's <literal>repmgrd</literal>
49      column.
50    </para>
51
52    <note>
53      <para>
54        After restarting PostgreSQL on any node, the &repmgrd; instance
55        will take a second or two before it is able to update its status. Until then,
56        &repmgrd; will be shown as not running.
57      </para>
58    </note>
59
60  </refsect1>
61
62  <refsect1>
63    <title>Examples</title>
64    <para>
65      &repmgrd; running normally on all nodes:
66    <programlisting>$ repmgr -f /etc/repmgr.conf service status
67 ID | Name  | Role    | Status    | Upstream | repmgrd | PID   | Paused? | Upstream last seen
68----+-------+---------+-----------+----------+---------+-------+---------+--------------------
69 1  | node1 | primary | * running |          | running | 96563 | no      | n/a
70 2  | node2 | standby |   running | node1    | running | 96572 | no      | 1 second(s) ago
71 3  | node3 | standby |   running | node1    | running | 96584 | no      | 0 second(s) ago</programlisting>
72    </para>
73
74    <para>
75      &repmgrd; paused on all nodes (using <xref linkend="repmgr-service-pause"/>):
76    <programlisting>$ repmgr -f /etc/repmgr.conf service status
77 ID | Name  | Role    | Status    | Upstream | repmgrd | PID   | Paused? | Upstream last seen
78----+-------+---------+-----------+----------+---------+-------+---------+--------------------
79 1  | node1 | primary | * running |          | running | 96563 | yes     | n/a
80 2  | node2 | standby |   running | node1    | running | 96572 | yes     | 1 second(s) ago
81 3  | node3 | standby |   running | node1    | running | 96584 | yes     | 0 second(s) ago</programlisting>
82    </para>
83
84    <para>
85      &repmgrd; not running on one node:
86    <programlisting>$ repmgr -f /etc/repmgr.conf service status
87 ID | Name  | Role    | Status    | Upstream | repmgrd     | PID   | Paused? | Upstream last seen
88----+-------+---------+-----------+----------+-------------+-------+---------+--------------------
89 1  | node1 | primary | * running |          | running     | 96563 | yes     | n/a
90 2  | node2 | standby |   running | node1    | not running | n/a   | n/a     | n/a
91 3  | node3 | standby |   running | node1    | running     | 96584 | yes     | 0 second(s) ago</programlisting>
92    </para>
93  </refsect1>
94
95  <refsect1>
96    <title>Options</title>
97
98    <variablelist>
99
100      <varlistentry>
101        <term><option>--csv</option></term>
102        <listitem>
103          <para>
104            <command>repmgr service status</command> accepts an optional parameter <literal>--csv</literal>, which
105            outputs the replication cluster's status in a simple CSV format, suitable for
106            parsing by scripts, e.g.:
107            <programlisting>
108    $ repmgr -f /etc/repmgr.conf service status --csv
109    1,node1,primary,1,1,5722,1,100,-1,default
110    2,node2,standby,1,0,-1,1,100,1,default
111    3,node3,standby,1,1,5779,1,100,1,default</programlisting>
112          </para>
113          <para>
114            The columns have following meanings:
115            <itemizedlist spacing="compact" mark="bullet">
116              <listitem>
117                <simpara>
118                  node ID
119                </simpara>
120              </listitem>
121
122              <listitem>
123                <simpara>
124                  node name
125                </simpara>
126              </listitem>
127
128              <listitem>
129                <simpara>
130                  node type (primary or standby)
131                </simpara>
132              </listitem>
133
134              <listitem>
135                <simpara>
136                  PostgreSQL server running (1 = running, 0 = not running)
137                </simpara>
138              </listitem>
139
140              <listitem>
141                <simpara>
142                  &repmgrd; running (1 = running, 0 = not running, -1 = unknown)
143                </simpara>
144              </listitem>
145
146              <listitem>
147                <simpara>
148                  &repmgrd; PID (-1 if not running or status unknown)
149                </simpara>
150              </listitem>
151
152              <listitem>
153                <simpara>
154                  &repmgrd; paused (1 = paused, 0 = not paused, -1 = unknown)
155                </simpara>
156              </listitem>
157
158              <listitem>
159                <simpara>
160                  &repmgrd; node priority
161                </simpara>
162              </listitem>
163
164              <listitem>
165                <simpara>
166                  interval in seconds since the node's upstream was last seen (this will be -1 if the value could not be retrieved, or the node is primary)
167                </simpara>
168              </listitem>
169
170			  <listitem>
171                <simpara>
172                  node location
173                </simpara>
174              </listitem>
175
176            </itemizedlist>
177          </para>
178        </listitem>
179	  </varlistentry>
180
181	  <varlistentry>
182        <term><option>--detail</option></term>
183        <listitem>
184          <para>
185            Display additional information (<literal>location</literal>, <literal>priority</literal>)
186	    about the &repmgr; configuration.
187          </para>
188        </listitem>
189      </varlistentry>
190
191      <varlistentry>
192        <term><option>--verbose</option></term>
193        <listitem>
194          <para>
195            Display the full text of any database connection error messages.
196          </para>
197        </listitem>
198      </varlistentry>
199
200    </variablelist>
201
202  </refsect1>
203
204  <refsect1>
205    <title>See also</title>
206    <para>
207      <xref linkend="repmgr-service-pause"/>,
208      <xref linkend="repmgr-service-unpause"/>,
209      <xref linkend="repmgr-cluster-show"/>,
210      <xref linkend="repmgrd-pausing"/>,
211      <xref linkend="repmgr-daemon-start"/>,
212      <xref linkend="repmgr-daemon-stop"/>
213    </para>
214  </refsect1>
215</refentry>
216