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>
12 <refname>onnode</refname>
13 <refpurpose>run commands on ctdb nodes</refpurpose>
18 <command>onnode [OPTION] ... NODES COMMAND ...</command>
22 <refsect1><title>DESCRIPTION</title>
24 onnode is a utility to run commands on a specific node of a CTDB
25 cluster, or on all nodes.
28 The NODES option specifies which node to run a command on. You
29 can specify a numeric node number (from 0 to N-1) or a
30 descriptive node specification (see DESCRIPTIVE NODE
31 SPECIFICATIONS below). You can also specify lists of nodes,
32 separated by commas, and ranges of numeric node numbers,
33 separated by dashes. If nodes are specified multiple times then
34 the command will be executed multiple times on those nodes. The
35 order of nodes is significant.
38 The COMMAND can be any shell command. The onnode utility uses
39 ssh or rsh to connect to the remote nodes and run the command.
43 <refsect1><title>DESCRIPTIVE NODE SPECIFICATIONS</title>
46 The following descriptive node specification can be used in
47 place of numeric node numbers:
51 <varlistentry><term>all</term>
58 <varlistentry><term>any</term>
61 A node where ctdbd is running. This semi-random but
62 there is a bias towards choosing a low numbered node.
66 <varlistentry><term>ok | healthy</term>
69 All nodes that are not disconnected, banned, disabled or
74 <varlistentry><term>con | connected</term>
77 All nodes that are not disconnected.
81 <varlistentry><term>lvs | lvsmaster</term>
84 The current LVS master.
88 <varlistentry><term>natgw | natgwlist</term>
91 The current NAT gateway.
95 <varlistentry><term>rm | recmaster</term>
98 The current recovery master.
105 <refsect1><title>OPTIONS</title>
108 <varlistentry><term>-c</term>
111 Execute COMMAND in the current working directory on the
117 <varlistentry><term>-o <prefix></term>
120 Causes standard output from each node to be saved into a
121 file with name <prefix>.<ip>.
126 <varlistentry><term>-p</term>
129 Run COMMAND in parallel on the specified nodes. The
130 default is to run COMMAND sequentially on each node.
135 <varlistentry><term>-q</term>
138 Do not print node addresses. Normally, onnode prints
139 informational node addresses if more than one node is
140 specified. This overrides -v.
145 <varlistentry><term>-n</term>
148 Allow nodes to be specified by name rather than node
149 numbers. These nodes don't need to be listed in the nodes
150 file. You can avoid the nodes file entirely by combining
151 this with <code>-f /dev/null</code>.
156 <varlistentry><term>-f <file></term>
159 Specify an alternative nodes file to use instead of
160 <filename>/etc/ctdb/nodes</filename>. This overrides the
161 CTDB_NODES_FILE environment variable.
166 <varlistentry><term>-v</term>
169 Print a node addresses even if only one node is specified.
170 Normally, onnode prints informational node addresses when
171 more than one node is specified.
176 <varlistentry><term>-h, --help</term>
179 Show a short usage guide.
186 <refsect1><title>EXAMPLES</title>
188 The following command would show the process ID of ctdb on all nodes
190 <screen format="linespecific">
191 onnode all pidof ctdbd
195 The following command would show the last 5 lines of log on each
196 node, preceded by the node's hostname
198 <screen format="linespecific">
199 onnode all "hostname; tail -5 /var/log/log.ctdb"
203 The following command would restart the ctdb service on all nodes.
205 <screen format="linespecific">
206 onnode all service ctdb restart
210 The following command would run ./foo in the current working
211 directory, in parallel, on nodes 0, 2, 3 and 4.
213 <screen format="linespecific">
214 onnode -c -p 0,2-4 ./foo
218 <refsect1><title>ENVIRONMENT</title>
221 <varlistentry><term><envar>CTDB_NODES_FILE</envar></term>
224 Name of alternative nodes file to use instead of
225 <filename>/etc/ctdb/nodes</filename>.
233 <refsect1><title>FILES</title>
236 <varlistentry><term><filename>/etc/ctdb/nodes</filename></term>
239 Default file containing a list of each node's IP address
245 <varlistentry><term><filename>/etc/ctdb/onnode.conf</filename></term>
248 If this file exists it is sourced by onnode. The main
249 purpose is to allow the administrator to set $SSH to
250 something other than "ssh". In this case the -t option is
251 ignored. For example, the administrator may choose to use
252 use rsh instead of ssh.
259 <refsect1><title>SEE ALSO</title>
261 ctdbd(1), ctdb(1), <ulink url="http://ctdb.samba.org/"/>
264 <refsect1><title>COPYRIGHT/LICENSE</title>
266 Copyright (C) Andrew Tridgell 2007
267 Copyright (C) Ronnie sahlberg 2007
268 Copyright (C) Martin Schwenke 2008
270 This program is free software; you can redistribute it and/or modify
271 it under the terms of the GNU General Public License as published by
272 the Free Software Foundation; either version 3 of the License, or (at
273 your option) any later version.
275 This program is distributed in the hope that it will be useful, but
276 WITHOUT ANY WARRANTY; without even the implied warranty of
277 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
278 General Public License for more details.
280 You should have received a copy of the GNU General Public License
281 along with this program; if not, see http://www.gnu.org/licenses/.