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