1 <?xml version="1.0" encoding="iso-8859-1"?>
3 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
5 <refentry id="onnode.1">
8 <refentrytitle>onnode</refentrytitle>
9 <manvolnum>1</manvolnum>
10 <refmiscinfo class="source">ctdb</refmiscinfo>
11 <refmiscinfo class="manual">CTDB - clustered TDB database</refmiscinfo>
15 <refname>onnode</refname>
16 <refpurpose>run commands on CTDB cluster nodes</refpurpose>
21 <command>onnode</command>
22 <arg rep="repeat"><replaceable>OPTION</replaceable></arg>
23 <arg choice="req"><replaceable>NODES</replaceable></arg>
24 <arg choice="req"><replaceable>COMMAND</replaceable></arg>
29 <title>DESCRIPTION</title>
31 onnode is a utility to run commands on a specific node of a CTDB
32 cluster, or on all nodes.
35 <replaceable>NODES</replaceable> specifies which node(s) to run
36 a command on. See section <citetitle>NODES
37 SPECIFICATION</citetitle> for details.
40 <replaceable>COMMAND</replaceable> can be any shell command. The
41 onnode utility uses ssh or rsh to connect to the remote nodes
47 <title>OPTIONS</title>
50 <varlistentry><term>-c</term>
53 Execute COMMAND in the current working directory on the
59 <varlistentry><term>-f <parameter>FILENAME</parameter></term>
62 Specify an alternative nodes FILENAME to use instead of
63 the default. This option overrides the CTDB_NODES_FILE
64 and CTDB_NODES variables. See the discussion of
65 <filename>/usr/local/etc/ctdb/nodes</filename> in the FILES section
71 <varlistentry><term>-i</term>
74 Keep standard input open, allowing data to be piped to
75 onnode. Normally onnode closes stdin to avoid surprises
76 when scripting. Note that this option is ignored when
77 using <option>-p</option> or if <envar>SSH</envar> is set
78 to anything other than "ssh".
83 <varlistentry><term>-n</term>
86 Allow nodes to be specified by name rather than node
87 numbers. These nodes don't need to be listed in the nodes
88 file. You can avoid the nodes file entirely by combining
89 this with <code>-f /dev/null</code>.
94 <varlistentry><term>-o <parameter>PREFIX</parameter></term>
97 Causes standard output from each node to be saved into a
98 file with name PREFIX.<replaceable>IP</replaceable>.
103 <varlistentry><term>-p</term>
106 Run COMMAND in parallel on the specified nodes. The
107 default is to run COMMAND sequentially on each node.
112 <varlistentry><term>-P</term>
115 Push files to nodes. Names of files to push are specified
116 rather than the usual command. Quoting is fragile/broken
117 - filenames with whitespace in them are not supported.
122 <varlistentry><term>-q</term>
125 Do not print node addresses. Normally, onnode prints
126 informational node addresses if more than one node is
127 specified. This overrides -v.
132 <varlistentry><term>-v</term>
135 Print node addresses even if only one node is specified.
136 Normally, onnode prints informational node addresses when
137 more than one node is specified.
142 <varlistentry><term>-h, --help</term>
145 Show a short usage guide.
153 <title>NODES SPECIFICATION</title>
156 Nodes can be specified via numeric node numbers (from 0 to N-1)
157 or mnemonics. Multiple nodes are specified using lists of
158 nodes, separated by commas, and ranges of numeric node numbers,
159 separated by dashes. If nodes are specified multiple times then
160 the command will be executed multiple times on those nodes. The
161 order of nodes is significant.
165 The following mnemonics are available:
169 <varlistentry><term>all</term>
176 <varlistentry><term>any</term>
179 A node where ctdbd is running. This semi-random but
180 there is a bias towards choosing a low numbered node.
184 <varlistentry><term>ok | healthy</term>
187 All nodes that are not disconnected, banned, disabled or
192 <varlistentry><term>con | connected</term>
195 All nodes that are not disconnected.
203 <title>EXAMPLES</title>
206 The following command would show the process ID of ctdbd on all nodes
208 <screen format="linespecific">
209 onnode all ctdb getpid
213 The following command would show the last 5 lines of log on each
214 node, preceded by the node's hostname
216 <screen format="linespecific">
217 onnode all "hostname; tail -5 /usr/local/var/log/log.ctdb"
221 The following command would restart the ctdb service on all
224 <screen format="linespecific">
225 onnode -p all service ctdb restart
229 The following command would run ./foo in the current working
230 directory, in parallel, on nodes 0, 2, 3 and 4.
232 <screen format="linespecific">
233 onnode -c -p 0,2-4 ./foo
238 <title>ENVIRONMENT</title>
241 <varlistentry><term><envar>CTDB_BASE</envar></term>
244 Directory containing CTDB configuration files. The
245 default is <filename>/usr/local/etc/ctdb</filename>.
250 <varlistentry><term><envar>CTDB_NODES_FILE</envar></term>
253 Name of alternative nodes file to use instead of the
254 default. See the <citetitle>FILES</citetitle> section for
267 <varlistentry><term><filename>/usr/local/etc/ctdb/nodes</filename></term>
270 Default file containing a list of each node's IP address
274 As above, a file specified via the <option>-f</option> or
275 <envar>CTDB_NODES_FILE</envar> is given precedence. If a
276 relative path is specified and no corresponding file
277 exists relative to the current directory then the file is
278 also searched for in the <filename>$CTDB_BASE</filename>
282 If <envar>CTDB_NODES_FILE</envar> is not set and
283 <envar>CTDB_NODES</envar> is set in configuration then the
284 file pointed to by <envar>CTDB_NODES</envar> is used.
287 Otherwise the default is
288 <filename>$CTDB_BASE/nodes</filename>, where
289 <envar>CTDB_BASE</envar> defaults to
290 <filename>/usr/local/etc/ctdb</filename>.
295 <varlistentry><term><filename>/usr/local/etc/ctdb/onnode.conf</filename></term>
298 If this file exists it is sourced by onnode. The main
299 purpose is to allow the administrator to set
300 <envar>SSH</envar> to something other than "ssh". In this
301 case the -t option is ignored. For example, the
302 administrator may choose to use use rsh instead of ssh.
310 <title>SEE ALSO</title>
313 <citerefentry><refentrytitle>ctdb</refentrytitle>
314 <manvolnum>7</manvolnum></citerefentry>,
316 <ulink url="http://ctdb.samba.org/"/>
323 This documentation was written by
331 <holder>Andrew Tridgell</holder>
332 <holder>Ronnie Sahlberg</holder>
336 <holder>Martin Schwenke</holder>
340 This program is free software; you can redistribute it and/or
341 modify it under the terms of the GNU General Public License as
342 published by the Free Software Foundation; either version 3 of
343 the License, or (at your option) any later version.
346 This program is distributed in the hope that it will be
347 useful, but WITHOUT ANY WARRANTY; without even the implied
348 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
349 PURPOSE. See the GNU General Public License for more details.
352 You should have received a copy of the GNU General Public
353 License along with this program; if not, see
354 <ulink url="http://www.gnu.org/licenses"/>.