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
162 <filename>/etc/ctdb/nodes</filename>. This overrides the
163 CTDB_NODES_FILE environment variable.
168 <varlistentry><term>-v</term>
171 Print a node addresses even if only one node is specified.
172 Normally, onnode prints informational node addresses when
173 more than one node is specified.
178 <varlistentry><term>-h, --help</term>
181 Show a short usage guide.
188 <refsect1><title>EXAMPLES</title>
190 The following command would show the process ID of ctdb on all nodes
192 <screen format="linespecific">
193 onnode all pidof ctdbd
197 The following command would show the last 5 lines of log on each
198 node, preceded by the node's hostname
200 <screen format="linespecific">
201 onnode all "hostname; tail -5 /var/log/log.ctdb"
205 The following command would restart the ctdb service on all nodes.
207 <screen format="linespecific">
208 onnode all service ctdb restart
212 The following command would run ./foo in the current working
213 directory, in parallel, on nodes 0, 2, 3 and 4.
215 <screen format="linespecific">
216 onnode -c -p 0,2-4 ./foo
220 <refsect1><title>ENVIRONMENT</title>
223 <varlistentry><term><envar>CTDB_NODES_FILE</envar></term>
226 Name of alternative nodes file to use instead of
227 <filename>/etc/ctdb/nodes</filename>.
235 <refsect1><title>FILES</title>
238 <varlistentry><term><filename>/etc/ctdb/nodes</filename></term>
241 Default file containing a list of each node's IP address
247 <varlistentry><term><filename>/etc/ctdb/onnode.conf</filename></term>
250 If this file exists it is sourced by onnode. The main
251 purpose is to allow the administrator to set $SSH to
252 something other than "ssh". In this case the -t option is
253 ignored. For example, the administrator may choose to use
254 use rsh instead of ssh.
261 <refsect1><title>SEE ALSO</title>
263 ctdbd(1), ctdb(1), <ulink url="http://ctdb.samba.org/"/>
266 <refsect1><title>COPYRIGHT/LICENSE</title>
268 Copyright (C) Andrew Tridgell 2007
269 Copyright (C) Ronnie sahlberg 2007
270 Copyright (C) Martin Schwenke 2008
272 This program is free software; you can redistribute it and/or modify
273 it under the terms of the GNU General Public License as published by
274 the Free Software Foundation; either version 3 of the License, or (at
275 your option) any later version.
277 This program is distributed in the hope that it will be useful, but
278 WITHOUT ANY WARRANTY; without even the implied warranty of
279 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
280 General Public License for more details.
282 You should have received a copy of the GNU General Public License
283 along with this program; if not, see http://www.gnu.org/licenses/.