doc/ctdb.1: add "See also" for ctdb getdbmap
[sahlberg/ctdb.git] / doc / onnode.1.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="onnode.1">
4
5 <refmeta>
6         <refentrytitle>onnode</refentrytitle>
7         <manvolnum>1</manvolnum>
8 </refmeta>
9
10
11 <refnamediv>
12         <refname>onnode</refname>
13         <refpurpose>run commands on ctdb nodes</refpurpose>
14 </refnamediv>
15
16 <refsynopsisdiv>
17         <cmdsynopsis>
18                 <command>onnode [OPTION] ... NODES COMMAND ...</command>
19         </cmdsynopsis>
20 </refsynopsisdiv>
21
22   <refsect1><title>DESCRIPTION</title>
23     <para>
24       onnode is a utility to run commands on a specific node of a CTDB
25       cluster, or on all nodes.
26     </para>
27     <para>
28       The NODES option specifies which node to run a command on.  You
29       can specify a numeric node number (from 0 to N-1) or a
30       descriptive node specification (see DESCRIPTIVE NODE
31       SPECIFICATIONS below).  You can also specify lists of nodes,
32       separated by commas, and ranges of numeric node numbers,
33       separated by dashes.  If nodes are specified multiple times then
34       the command will be executed multiple times on those nodes.  The
35       order of nodes is significant.
36     </para>
37     <para>
38       The COMMAND can be any shell command. The onnode utility uses
39       ssh or rsh to connect to the remote nodes and run the command.
40     </para>
41   </refsect1>
42
43   <refsect1><title>DESCRIPTIVE NODE SPECIFICATIONS</title>
44
45     <para>
46       The following descriptive node specification can be used in
47       place of numeric node numbers:
48     </para>
49
50     <variablelist>
51       <varlistentry><term>all</term>
52         <listitem>
53           <para>
54             All nodes.
55           </para>
56         </listitem>
57       </varlistentry>
58       <varlistentry><term>any</term>
59         <listitem>
60           <para>
61              A node where ctdbd is running.  This semi-random but
62              there is a bias towards choosing a low numbered node.
63           </para>
64         </listitem>
65       </varlistentry>
66       <varlistentry><term>ok | healthy</term>
67         <listitem>
68           <para>
69             All nodes that are not disconnected, banned, disabled or
70             unhealthy.
71           </para>
72         </listitem>
73       </varlistentry>
74       <varlistentry><term>con | connected</term>
75         <listitem>
76           <para>
77             All nodes that are not disconnected.
78           </para>
79         </listitem>
80       </varlistentry>
81       <varlistentry><term>lvs | lvsmaster</term>
82         <listitem>
83           <para>
84             The current LVS master.
85           </para>
86         </listitem>
87       </varlistentry>
88       <varlistentry><term>natgw | natgwlist</term>
89         <listitem>
90           <para>
91             The current NAT gateway.
92           </para>
93         </listitem>
94       </varlistentry>
95       <varlistentry><term>rm | recmaster</term>
96         <listitem>
97           <para>
98             The current recovery master.
99           </para>
100         </listitem>
101       </varlistentry>
102     </variablelist>
103   </refsect1>
104
105   <refsect1><title>OPTIONS</title>
106
107     <variablelist>
108       <varlistentry><term>-c</term>
109         <listitem>
110           <para>
111             Execute COMMAND in the current working directory on the
112             specified nodes.
113           </para>
114         </listitem>
115       </varlistentry>
116
117       <varlistentry><term>-o &lt;prefix&gt;</term>
118         <listitem>
119           <para>
120             Causes standard output from each node to be saved into a
121             file with name &lt;prefix&gt;.&lt;ip&gt;.
122           </para>
123         </listitem>
124       </varlistentry>
125
126       <varlistentry><term>-p</term>
127         <listitem>
128           <para>
129             Run COMMAND in parallel on the specified nodes.  The
130             default is to run COMMAND sequentially on each node.
131           </para>
132         </listitem>
133       </varlistentry>
134
135       <varlistentry><term>-q</term>
136         <listitem>
137           <para>
138             Do not print node addresses.  Normally, onnode prints
139             informational node addresses if more than one node is
140             specified.  This overrides -v.
141           </para>
142         </listitem>
143       </varlistentry>
144
145       <varlistentry><term>-n</term>
146         <listitem>
147           <para>
148             Allow nodes to be specified by name rather than node
149             numbers.  These nodes don't need to be listed in the nodes
150             file.  You can avoid the nodes file entirely by combining
151             this with <code>-f /dev/null</code>.
152           </para>
153         </listitem>
154       </varlistentry>
155
156       <varlistentry><term>-f &lt;file&gt;</term>
157         <listitem>
158           <para>
159             Specify an alternative nodes file to use instead of
160             <filename>/etc/ctdb/nodes</filename>.  This overrides the
161             CTDB_NODES_FILE environment variable.
162           </para>
163         </listitem>
164       </varlistentry>
165
166       <varlistentry><term>-v</term>
167         <listitem>
168           <para>
169             Print a node addresses even if only one node is specified.
170             Normally, onnode prints informational node addresses when
171             more than one node is specified.
172           </para>
173         </listitem>
174       </varlistentry>
175
176       <varlistentry><term>-h, --help</term>
177         <listitem>
178           <para>
179             Show a short usage guide.
180           </para>
181         </listitem>
182       </varlistentry>
183     </variablelist>
184   </refsect1>
185
186   <refsect1><title>EXAMPLES</title>
187     <para>
188       The following command would show the process ID of ctdb on all nodes
189     </para>
190     <screen format="linespecific">
191       onnode all pidof ctdbd
192     </screen>
193
194     <para>
195       The following command would show the last 5 lines of log on each
196       node, preceded by the node's hostname
197     </para>
198     <screen format="linespecific">
199       onnode all "hostname; tail -5 /var/log/log.ctdb"
200     </screen>
201
202     <para>
203       The following command would restart the ctdb service on all nodes.
204     </para>
205     <screen format="linespecific">
206       onnode all service ctdb restart
207     </screen>
208
209     <para>
210       The following command would run ./foo in the current working
211       directory, in parallel, on nodes 0, 2, 3 and 4.
212     </para>
213     <screen format="linespecific">
214       onnode -c -p 0,2-4 ./foo
215     </screen>
216   </refsect1>
217
218   <refsect1><title>ENVIRONMENT</title>
219
220     <variablelist>
221       <varlistentry><term><envar>CTDB_NODES_FILE</envar></term>
222         <listitem>
223           <para>
224             Name of alternative nodes file to use instead of
225             <filename>/etc/ctdb/nodes</filename>.
226           </para>
227         </listitem>
228       </varlistentry>
229
230     </variablelist>
231   </refsect1>
232
233   <refsect1><title>FILES</title>
234
235     <variablelist>
236       <varlistentry><term><filename>/etc/ctdb/nodes</filename></term>
237         <listitem>
238           <para>
239             Default file containing a list of each node's IP address
240             or hostname.
241           </para>
242         </listitem>
243       </varlistentry>
244
245       <varlistentry><term><filename>/etc/ctdb/onnode.conf</filename></term>
246         <listitem>
247           <para>
248             If this file exists it is sourced by onnode.  The main
249             purpose is to allow the administrator to set $SSH to
250             something other than "ssh".  In this case the -t option is
251             ignored.  For example, the administrator may choose to use
252             use rsh instead of ssh.
253           </para>
254         </listitem>
255       </varlistentry>
256     </variablelist>
257   </refsect1>
258
259   <refsect1><title>SEE ALSO</title>
260     <para>
261       ctdbd(1), ctdb(1), <ulink url="http://ctdb.samba.org/"/>
262     </para>
263   </refsect1>
264   <refsect1><title>COPYRIGHT/LICENSE</title>
265 <literallayout>
266 Copyright (C) Andrew Tridgell 2007
267 Copyright (C) Ronnie sahlberg 2007
268 Copyright (C) Martin Schwenke 2008
269
270 This program is free software; you can redistribute it and/or modify
271 it under the terms of the GNU General Public License as published by
272 the Free Software Foundation; either version 3 of the License, or (at
273 your option) any later version.
274
275 This program is distributed in the hope that it will be useful, but
276 WITHOUT ANY WARRANTY; without even the implied warranty of
277 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
278 General Public License for more details.
279
280 You should have received a copy of the GNU General Public License
281 along with this program; if not, see http://www.gnu.org/licenses/.
282 </literallayout>
283   </refsect1>
284 </refentry>