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">
6 <refentrytitle>onnode</refentrytitle>
7 <manvolnum>1</manvolnum>
8 <refmiscinfo class="source"> </refmiscinfo>
9 <refmiscinfo class="manual"> </refmiscinfo>
14 <refname>onnode</refname>
15 <refpurpose>run commands on ctdb nodes</refpurpose>
20 <command>onnode [OPTION] ... NODES COMMAND ...</command>
24 <refsect1><title>DESCRIPTION</title>
26 onnode is a utility to run commands on a specific node of a CTDB
27 cluster, or on all nodes.
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.
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.
45 <refsect1><title>DESCRIPTIVE NODE SPECIFICATIONS</title>
48 The following descriptive node specification can be used in
49 place of numeric node numbers:
53 <varlistentry><term>all</term>
60 <varlistentry><term>any</term>
63 A node where ctdbd is running. This semi-random but
64 there is a bias towards choosing a low numbered node.
68 <varlistentry><term>ok | healthy</term>
71 All nodes that are not disconnected, banned, disabled or
76 <varlistentry><term>con | connected</term>
79 All nodes that are not disconnected.
83 <varlistentry><term>lvs | lvsmaster</term>
86 The current LVS master.
90 <varlistentry><term>natgw | natgwlist</term>
93 The current NAT gateway.
97 <varlistentry><term>rm | recmaster</term>
100 The current recovery master.
107 <refsect1><title>OPTIONS</title>
110 <varlistentry><term>-c</term>
113 Execute COMMAND in the current working directory on the
119 <varlistentry><term>-o <prefix></term>
122 Causes standard output from each node to be saved into a
123 file with name <prefix>.<ip>.
128 <varlistentry><term>-p</term>
131 Run COMMAND in parallel on the specified nodes. The
132 default is to run COMMAND sequentially on each node.
137 <varlistentry><term>-q</term>
140 Do not print node addresses. Normally, onnode prints
141 informational node addresses if more than one node is
142 specified. This overrides -v.
147 <varlistentry><term>-n</term>
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>.
158 <varlistentry><term>-f <file></term>
161 Specify an alternative nodes file to use instead of the
162 default. This option overrides the CTDB_NODES_FILE
163 environment variable. See the discussion of
164 <filename>/etc/ctdb/nodes</filename> in the FILES section
170 <varlistentry><term>-v</term>
173 Print a node addresses even if only one node is specified.
174 Normally, onnode prints informational node addresses when
175 more than one node is specified.
180 <varlistentry><term>-h, --help</term>
183 Show a short usage guide.
190 <refsect1><title>EXAMPLES</title>
192 The following command would show the process ID of ctdb on all nodes
194 <screen format="linespecific">
195 onnode all pidof ctdbd
199 The following command would show the last 5 lines of log on each
200 node, preceded by the node's hostname
202 <screen format="linespecific">
203 onnode all "hostname; tail -5 /var/log/log.ctdb"
207 The following command would restart the ctdb service on all nodes.
209 <screen format="linespecific">
210 onnode all service ctdb restart
214 The following command would run ./foo in the current working
215 directory, in parallel, on nodes 0, 2, 3 and 4.
217 <screen format="linespecific">
218 onnode -c -p 0,2-4 ./foo
222 <refsect1><title>ENVIRONMENT</title>
225 <varlistentry><term><envar>CTDB_NODES_FILE</envar></term>
228 Name of alternative nodes file to use instead of the
229 default. See the discussion of
230 <filename>/etc/ctdb/nodes</filename> in the FILES section
239 <refsect1><title>FILES</title>
242 <varlistentry><term><filename>/etc/ctdb/nodes</filename></term>
245 Default file containing a list of each node's IP address
249 Actually, the default is
250 <filename>$<envar>CTDB_BASE</envar>/nodes</filename>,
251 where <envar>$CTDB_BASE</envar> defaults to
252 <filename>/etc/ctdb</filename>. If a relative path is
253 given (via the -f option or <envar>$CTDB_BASE</envar>) and
254 no corresponding file exists relative to the current
255 directory then the file is also searched for in the
256 <filename>$<envar>CTDB_BASE</envar></filename> directory.
261 <varlistentry><term><filename>/etc/ctdb/onnode.conf</filename></term>
264 If this file exists it is sourced by onnode. The main
265 purpose is to allow the administrator to set $SSH to
266 something other than "ssh". In this case the -t option is
267 ignored. For example, the administrator may choose to use
268 use rsh instead of ssh.
275 <refsect1><title>SEE ALSO</title>
277 ctdbd(1), ctdb(1), <ulink url="http://ctdb.samba.org/"/>
280 <refsect1><title>COPYRIGHT/LICENSE</title>
282 Copyright (C) Andrew Tridgell 2007
283 Copyright (C) Ronnie sahlberg 2007
284 Copyright (C) Martin Schwenke 2008
286 This program is free software; you can redistribute it and/or modify
287 it under the terms of the GNU General Public License as published by
288 the Free Software Foundation; either version 3 of the License, or (at
289 your option) any later version.
291 This program is distributed in the hope that it will be useful, but
292 WITHOUT ANY WARRANTY; without even the implied warranty of
293 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
294 General Public License for more details.
296 You should have received a copy of the GNU General Public License
297 along with this program; if not, see http://www.gnu.org/licenses/.