idocument how to remove a node from an existing cluster using 'ctdb
[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 </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>ok | healthy</term>
59         <listitem>
60           <para>
61             All nodes that are not disconnected, banned, disabled or
62             unhealthy.
63           </para>
64         </listitem>
65       </varlistentry>
66       <varlistentry><term>con | connected</term>
67         <listitem>
68           <para>
69             All nodes that are not disconnected.
70           </para>
71         </listitem>
72       </varlistentry>
73       <varlistentry><term>lvs | lvsmaster</term>
74         <listitem>
75           <para>
76             The current LVS master.
77           </para>
78         </listitem>
79       </varlistentry>
80       <varlistentry><term>natgw | natgwlist</term>
81         <listitem>
82           <para>
83             The current NAT gateway.
84           </para>
85         </listitem>
86       </varlistentry>
87       <varlistentry><term>rm | recmaster</term>
88         <listitem>
89           <para>
90             The current recovery master.
91           </para>
92         </listitem>
93       </varlistentry>
94     </variablelist>
95   </refsect1>
96
97   <refsect1><title>OPTIONS</title>
98
99     <variablelist>
100       <varlistentry><term>-c</term>
101         <listitem>
102           <para>
103             Execute COMMAND in the current working directory on the
104             specified nodes.
105           </para>
106         </listitem>
107       </varlistentry>
108
109       <varlistentry><term>-o &lt;prefix&gt;</term>
110         <listitem>
111           <para>
112             Causes standard output from each node to be saved into a
113             file with name &lt;prefix&gt;.&lt;ip&gt;.
114           </para>
115         </listitem>
116       </varlistentry>
117
118       <varlistentry><term>-p</term>
119         <listitem>
120           <para>
121             Run COMMAND in parallel on the specified nodes.  The
122             default is to run COMMAND sequentially on each node.
123           </para>
124         </listitem>
125       </varlistentry>
126
127       <varlistentry><term>-q</term>
128         <listitem>
129           <para>
130             Do not print node addresses.  Normally, onnode prints
131             informational node addresses if more than one node is
132             specified.  This overrides -v.
133           </para>
134         </listitem>
135       </varlistentry>
136
137       <varlistentry><term>-v</term>
138         <listitem>
139           <para>
140             Print a node addresses even if only one node is specified.
141             Normally, onnode prints informational node addresses when
142             more than one node is specified.
143           </para>
144         </listitem>
145       </varlistentry>
146
147       <varlistentry><term>-h, --help</term>
148         <listitem>
149           <para>
150             Show a short usage guide.
151           </para>
152         </listitem>
153       </varlistentry>
154     </variablelist>
155   </refsect1>
156
157   <refsect1><title>EXAMPLES</title>
158     <para>
159       The following command would show the process ID of ctdb on all nodes
160     </para>
161     <screen format="linespecific">
162       onnode all pidof ctdbd
163     </screen>
164
165     <para>
166       The following command would show the last 5 lines of log on each
167       node, preceded by the node's hostname
168     </para>
169     <screen format="linespecific">
170       onnode all "hostname; tail -5 /var/log/log.ctdb"
171     </screen>
172
173     <para>
174       The following command would restart the ctdb service on all nodes.
175     </para>
176     <screen format="linespecific">
177       onnode all service ctdb restart
178     </screen>
179
180     <para>
181       The following command would run ./foo in the current working
182       directory, in parallel, on nodes 0, 2, 3 and 4.
183     </para>
184     <screen format="linespecific">
185       onnode -c -p 0,2-4 ./foo
186     </screen>
187   </refsect1>
188
189   <refsect1><title>FILES</title>
190
191     <variablelist>
192       <varlistentry><term>/etc/ctdb/nodes</term>
193         <listitem>
194           <para>
195             Contains a list of each node's IP address or hostname.
196           </para>
197         </listitem>
198       </varlistentry>
199
200       <varlistentry><term>/etc/ctdb/onnode.conf</term>
201         <listitem>
202           <para>
203             If this file exists it is sourced by onnode.  The main
204             purpose is to allow the administrator to set $SSH to
205             something other than "ssh".  In this case the -t option is
206             ignored.  For example, the administrator may choose to use
207             use rsh instead of ssh.
208           </para>
209         </listitem>
210       </varlistentry>
211     </variablelist>
212   </refsect1>
213
214   <refsect1><title>SEE ALSO</title>
215     <para>
216       ctdbd(1), ctdb(1), <ulink url="http://ctdb.samba.org/"/>
217     </para>
218   </refsect1>
219   <refsect1><title>COPYRIGHT/LICENSE</title>
220 <literallayout>
221 Copyright (C) Andrew Tridgell 2007
222 Copyright (C) Ronnie sahlberg 2007
223 Copyright (C) Martin Schwenke 2008
224
225 This program is free software; you can redistribute it and/or modify
226 it under the terms of the GNU General Public License as published by
227 the Free Software Foundation; either version 3 of the License, or (at
228 your option) any later version.
229
230 This program is distributed in the hope that it will be useful, but
231 WITHOUT ANY WARRANTY; without even the implied warranty of
232 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
233 General Public License for more details.
234
235 You should have received a copy of the GNU General Public License
236 along with this program; if not, see http://www.gnu.org/licenses/.
237 </literallayout>
238   </refsect1>
239 </refentry>