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. See the discussion of
64 <filename>/usr/local/etc/ctdb/nodes</filename> in the
65 FILES section for more details.
70 <varlistentry><term>-i</term>
73 Keep standard input open, allowing data to be piped to
74 onnode. Normally onnode closes stdin to avoid surprises
75 when scripting. Note that this option is ignored when
76 using <option>-p</option> or if <envar>ONNODE_SSH</envar>
77 is set to anything other than "ssh".
82 <varlistentry><term>-n</term>
85 Allow nodes to be specified by name rather than node
86 numbers. These nodes don't need to be listed in the nodes
87 file. You can avoid the nodes file entirely by combining
88 this with <code>-f /dev/null</code>.
93 <varlistentry><term>-p</term>
96 Run COMMAND in parallel on the specified nodes. The
97 default is to run COMMAND sequentially on each node.
102 <varlistentry><term>-P</term>
105 Push files to nodes. Names of files to push are specified
106 rather than the usual command. Quoting is fragile/broken
107 - filenames with whitespace in them are not supported.
112 <varlistentry><term>-q</term>
115 Do not print node addresses. Normally, onnode prints
116 informational node addresses if more than one node is
117 specified. This overrides -v.
122 <varlistentry><term>-v</term>
125 Print node addresses even if only one node is specified.
126 Normally, onnode prints informational node addresses when
127 more than one node is specified.
132 <varlistentry><term>-h, --help</term>
135 Show a short usage guide.
143 <title>NODES SPECIFICATION</title>
146 Nodes can be specified via numeric node numbers (from 0 to N-1)
147 or mnemonics. Multiple nodes are specified using lists of
148 nodes, separated by commas, and ranges of numeric node numbers,
149 separated by dashes. If nodes are specified multiple times then
150 the command will be executed multiple times on those nodes. The
151 order of nodes is significant.
155 The following mnemonics are available:
159 <varlistentry><term>all</term>
166 <varlistentry><term>any</term>
169 A node where ctdbd is running. This semi-random but
170 there is a bias towards choosing a low numbered node.
174 <varlistentry><term>ok | healthy</term>
177 All nodes that are not disconnected, banned, disabled or
182 <varlistentry><term>con | connected</term>
185 All nodes that are not disconnected.
193 <title>EXAMPLES</title>
196 The following command would show the process ID of ctdbd on all nodes
198 <screen format="linespecific">
199 onnode all ctdb getpid
203 The following command would show the last 5 lines of log on each
204 node, preceded by the node's hostname
206 <screen format="linespecific">
207 onnode all "hostname; tail -5 /usr/local/var/log/log.ctdb"
211 The following command would restart the ctdb service on all
214 <screen format="linespecific">
215 onnode -p all service ctdb restart
219 The following command would run ./foo in the current working
220 directory, in parallel, on nodes 0, 2, 3 and 4.
222 <screen format="linespecific">
223 onnode -c -p 0,2-4 ./foo
231 <varlistentry><term><filename>/usr/local/etc/ctdb/nodes</filename></term>
234 Default file containing a list of each node's IP address
238 As above, a file specified via the <option>-f</option>
239 is given precedence. If a
240 relative path is specified and no corresponding file
241 exists relative to the current directory then the file is
242 also searched for in the CTDB configuration directory.
245 Otherwise the default is
246 <filename>/usr/local/etc/ctdb/nodes</filename>.
252 <term><filename>/usr/local/etc/ctdb/onnode.conf</filename></term>
255 If this file exists it is sourced by onnode. The main
256 purpose is to allow the administrator to set
257 <envar>ONNODE_SSH</envar> to something other than "ssh".
258 In this case the -t option is ignored.
266 <title>SEE ALSO</title>
269 <citerefentry><refentrytitle>ctdb</refentrytitle>
270 <manvolnum>7</manvolnum></citerefentry>,
272 <ulink url="http://ctdb.samba.org/"/>
279 This documentation was written by
287 <holder>Andrew Tridgell</holder>
288 <holder>Ronnie Sahlberg</holder>
292 <holder>Martin Schwenke</holder>
296 This program is free software; you can redistribute it and/or
297 modify it under the terms of the GNU General Public License as
298 published by the Free Software Foundation; either version 3 of
299 the License, or (at your option) any later version.
302 This program is distributed in the hope that it will be
303 useful, but WITHOUT ANY WARRANTY; without even the implied
304 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
305 PURPOSE. See the GNU General Public License for more details.
308 You should have received a copy of the GNU General Public
309 License along with this program; if not, see
310 <ulink url="http://www.gnu.org/licenses"/>.