1 <?xml version="1.0" encoding="iso-8859-1"?>
3 PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5 <refentry id="onnode.1">
8 <refentrytitle>onnode</refentrytitle>
9 <manvolnum>1</manvolnum>
10 <refmiscinfo class="source"> </refmiscinfo>
11 <refmiscinfo class="manual"> </refmiscinfo>
16 <refname>onnode</refname>
17 <refpurpose>run commands on ctdb nodes</refpurpose>
22 <command>onnode [OPTION] ... NODES COMMAND ...</command>
26 <refsect1><title>DESCRIPTION</title>
28 onnode is a utility to run commands on a specific node of a CTDB
29 cluster, or on all nodes.
32 The NODES option specifies which node to run a command on. You
33 can specify a numeric node number (from 0 to N-1) or a
34 descriptive node specification (see DESCRIPTIVE NODE
35 SPECIFICATIONS below). You can also specify lists of nodes,
36 separated by commas, and ranges of numeric node numbers,
37 separated by dashes. If nodes are specified multiple times then
38 the command will be executed multiple times on those nodes. The
39 order of nodes is significant.
42 The COMMAND can be any shell command. The onnode utility uses
43 ssh or rsh to connect to the remote nodes and run the command.
47 <refsect1><title>DESCRIPTIVE NODE SPECIFICATIONS</title>
50 The following descriptive node specification can be used in
51 place of numeric node numbers:
55 <varlistentry><term>all</term>
62 <varlistentry><term>any</term>
65 A node where ctdbd is running. This semi-random but
66 there is a bias towards choosing a low numbered node.
70 <varlistentry><term>ok | healthy</term>
73 All nodes that are not disconnected, banned, disabled or
78 <varlistentry><term>con | connected</term>
81 All nodes that are not disconnected.
85 <varlistentry><term>lvs | lvsmaster</term>
88 The current LVS master.
92 <varlistentry><term>natgw | natgwlist</term>
95 The current NAT gateway.
99 <varlistentry><term>rm | recmaster</term>
102 The current recovery master.
109 <refsect1><title>OPTIONS</title>
112 <varlistentry><term>-c</term>
115 Execute COMMAND in the current working directory on the
121 <varlistentry><term>-o <prefix></term>
124 Causes standard output from each node to be saved into a
125 file with name <prefix>.<ip>.
130 <varlistentry><term>-p</term>
133 Run COMMAND in parallel on the specified nodes. The
134 default is to run COMMAND sequentially on each node.
139 <varlistentry><term>-q</term>
142 Do not print node addresses. Normally, onnode prints
143 informational node addresses if more than one node is
144 specified. This overrides -v.
149 <varlistentry><term>-n</term>
152 Allow nodes to be specified by name rather than node
153 numbers. These nodes don't need to be listed in the nodes
154 file. You can avoid the nodes file entirely by combining
155 this with <code>-f /dev/null</code>.
160 <varlistentry><term>-f <file></term>
163 Specify an alternative nodes file to use instead of the
164 default. This option overrides the CTDB_NODES_FILE
165 environment variable. See the discussion of
166 <filename>/etc/ctdb/nodes</filename> in the FILES section
172 <varlistentry><term>-v</term>
175 Print a node addresses even if only one node is specified.
176 Normally, onnode prints informational node addresses when
177 more than one node is specified.
182 <varlistentry><term>-P</term>
185 Push files to nodes. Names of files to push are specified
186 rather than the usual command. Quoting is fragile/broken
187 - filenames with whitespace in them are not supported.
192 <varlistentry><term>-h, --help</term>
195 Show a short usage guide.
202 <refsect1><title>EXAMPLES</title>
204 The following command would show the process ID of ctdb on all nodes
206 <screen format="linespecific">
207 onnode all pidof ctdbd
211 The following command would show the last 5 lines of log on each
212 node, preceded by the node's hostname
214 <screen format="linespecific">
215 onnode all "hostname; tail -5 /var/log/log.ctdb"
219 The following command would restart the ctdb service on all nodes.
221 <screen format="linespecific">
222 onnode all service ctdb restart
226 The following command would run ./foo in the current working
227 directory, in parallel, on nodes 0, 2, 3 and 4.
229 <screen format="linespecific">
230 onnode -c -p 0,2-4 ./foo
234 <refsect1><title>ENVIRONMENT</title>
237 <varlistentry><term><envar>CTDB_NODES_FILE</envar></term>
240 Name of alternative nodes file to use instead of the
241 default. See the discussion of
242 <filename>/etc/ctdb/nodes</filename> in the FILES section
251 <refsect1><title>FILES</title>
254 <varlistentry><term><filename>/etc/ctdb/nodes</filename></term>
257 Default file containing a list of each node's IP address
261 Actually, the default is
262 <filename>$<envar>CTDB_BASE</envar>/nodes</filename>,
263 where <envar>$CTDB_BASE</envar> defaults to
264 <filename>/etc/ctdb</filename>. If a relative path is
265 given (via the -f option or <envar>$CTDB_BASE</envar>) and
266 no corresponding file exists relative to the current
267 directory then the file is also searched for in the
268 <filename>$<envar>CTDB_BASE</envar></filename> directory.
273 <varlistentry><term><filename>/etc/ctdb/onnode.conf</filename></term>
276 If this file exists it is sourced by onnode. The main
277 purpose is to allow the administrator to set $SSH to
278 something other than "ssh". In this case the -t option is
279 ignored. For example, the administrator may choose to use
280 use rsh instead of ssh.
287 <refsect1><title>SEE ALSO</title>
289 ctdbd(1), ctdb(1), <ulink url="http://ctdb.samba.org/"/>
292 <refsect1><title>COPYRIGHT/LICENSE</title>
294 Copyright (C) Andrew Tridgell 2007
295 Copyright (C) Ronnie sahlberg 2007
296 Copyright (C) Martin Schwenke 2008
298 This program is free software; you can redistribute it and/or modify
299 it under the terms of the GNU General Public License as published by
300 the Free Software Foundation; either version 3 of the License, or (at
301 your option) any later version.
303 This program is distributed in the hope that it will be useful, but
304 WITHOUT ANY WARRANTY; without even the implied warranty of
305 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
306 General Public License for more details.
308 You should have received a copy of the GNU General Public License
309 along with this program; if not, see http://www.gnu.org/licenses/.