1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>onnode</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="onnode"><a name="onnode.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>onnode — run commands on ctdb nodes</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">onnode [OPTION] ... NODES COMMAND ...</code> </p></div></div><div class="refsect1" title="DESCRIPTION"><a name="id2602518"></a><h2>DESCRIPTION</h2><p>
2 onnode is a utility to run commands on a specific node of a CTDB
3 cluster, or on all nodes.
5 The NODES option specifies which node to run a command on. You
6 can specify a numeric node number (from 0 to N-1) or a
7 descriptive node specification (see DESCRIPTIVE NODE
8 SPECIFICATIONS below). You can also specify lists of nodes,
9 separated by commas, and ranges of numeric node numbers,
10 separated by dashes. If nodes are specified multiple times then
11 the command will be executed multiple times on those nodes. The
12 order of nodes is significant.
14 The COMMAND can be any shell command. The onnode utility uses
15 ssh or rsh to connect to the remote nodes and run the command.
16 </p></div><div class="refsect1" title="DESCRIPTIVE NODE SPECIFICATIONS"><a name="id2602547"></a><h2>DESCRIPTIVE NODE SPECIFICATIONS</h2><p>
17 The following descriptive node specification can be used in
18 place of numeric node numbers:
19 </p><div class="variablelist"><dl><dt><span class="term">all</span></dt><dd><p>
21 </p></dd><dt><span class="term">any</span></dt><dd><p>
22 A node where ctdbd is running. This semi-random but
23 there is a bias towards choosing a low numbered node.
24 </p></dd><dt><span class="term">ok | healthy</span></dt><dd><p>
25 All nodes that are not disconnected, banned, disabled or
27 </p></dd><dt><span class="term">con | connected</span></dt><dd><p>
28 All nodes that are not disconnected.
29 </p></dd><dt><span class="term">lvs | lvsmaster</span></dt><dd><p>
30 The current LVS master.
31 </p></dd><dt><span class="term">natgw | natgwlist</span></dt><dd><p>
32 The current NAT gateway.
33 </p></dd><dt><span class="term">rm | recmaster</span></dt><dd><p>
34 The current recovery master.
35 </p></dd></dl></div></div><div class="refsect1" title="OPTIONS"><a name="id2600718"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-c</span></dt><dd><p>
36 Execute COMMAND in the current working directory on the
38 </p></dd><dt><span class="term">-o <prefix></span></dt><dd><p>
39 Causes standard output from each node to be saved into a
40 file with name <prefix>.<ip>.
41 </p></dd><dt><span class="term">-p</span></dt><dd><p>
42 Run COMMAND in parallel on the specified nodes. The
43 default is to run COMMAND sequentially on each node.
44 </p></dd><dt><span class="term">-q</span></dt><dd><p>
45 Do not print node addresses. Normally, onnode prints
46 informational node addresses if more than one node is
47 specified. This overrides -v.
48 </p></dd><dt><span class="term">-n</span></dt><dd><p>
49 Allow nodes to be specified by name rather than node
50 numbers. These nodes don't need to be listed in the nodes
51 file. You can avoid the nodes file entirely by combining
52 this with <code class="code">-f /dev/null</code>.
53 </p></dd><dt><span class="term">-f <file></span></dt><dd><p>
54 Specify an alternative nodes file to use instead of the
55 default. This option overrides the CTDB_NODES_FILE
56 environment variable. See the discussion of
57 <code class="filename">/etc/ctdb/nodes</code> in the FILES section
59 </p></dd><dt><span class="term">-v</span></dt><dd><p>
60 Print a node addresses even if only one node is specified.
61 Normally, onnode prints informational node addresses when
62 more than one node is specified.
63 </p></dd><dt><span class="term">-h, --help</span></dt><dd><p>
64 Show a short usage guide.
65 </p></dd></dl></div></div><div class="refsect1" title="EXAMPLES"><a name="id2600855"></a><h2>EXAMPLES</h2><p>
66 The following command would show the process ID of ctdb on all nodes
67 </p><pre class="screen">
68 onnode all pidof ctdbd
70 The following command would show the last 5 lines of log on each
71 node, preceded by the node's hostname
72 </p><pre class="screen">
73 onnode all "hostname; tail -5 /var/log/log.ctdb"
75 The following command would restart the ctdb service on all nodes.
76 </p><pre class="screen">
77 onnode all service ctdb restart
79 The following command would run ./foo in the current working
80 directory, in parallel, on nodes 0, 2, 3 and 4.
81 </p><pre class="screen">
82 onnode -c -p 0,2-4 ./foo
83 </pre></div><div class="refsect1" title="ENVIRONMENT"><a name="id2600905"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl><dt><span class="term"><code class="envar">CTDB_NODES_FILE</code></span></dt><dd><p>
84 Name of alternative nodes file to use instead of the
85 default. See the discussion of
86 <code class="filename">/etc/ctdb/nodes</code> in the FILES section
88 </p></dd></dl></div></div><div class="refsect1" title="FILES"><a name="id2652169"></a><h2>FILES</h2><div class="variablelist"><dl><dt><span class="term"><code class="filename">/etc/ctdb/nodes</code></span></dt><dd><p>
89 Default file containing a list of each node's IP address
92 Actually, the default is
93 <code class="filename">$<code class="envar">CTDB_BASE</code>/nodes</code>,
94 where <code class="envar">$CTDB_BASE</code> defaults to
95 <code class="filename">/etc/ctdb</code>. If a relative path is
96 given (via the -f option or <code class="envar">$CTDB_BASE</code>) and
97 no corresponding file exists relative to the current
98 directory then the file is also searched for in the
99 <code class="filename">$<code class="envar">CTDB_BASE</code></code> directory.
100 </p></dd><dt><span class="term"><code class="filename">/etc/ctdb/onnode.conf</code></span></dt><dd><p>
101 If this file exists it is sourced by onnode. The main
102 purpose is to allow the administrator to set $SSH to
103 something other than "ssh". In this case the -t option is
104 ignored. For example, the administrator may choose to use
105 use rsh instead of ssh.
106 </p></dd></dl></div></div><div class="refsect1" title="SEE ALSO"><a name="id2652258"></a><h2>SEE ALSO</h2><p>
107 ctdbd(1), ctdb(1), <a class="ulink" href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
108 </p></div><div class="refsect1" title="COPYRIGHT/LICENSE"><a name="id2652271"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
109 Copyright (C) Andrew Tridgell 2007<br>
110 Copyright (C) Ronnie sahlberg 2007<br>
111 Copyright (C) Martin Schwenke 2008<br>
113 This program is free software; you can redistribute it and/or modify<br>
114 it under the terms of the GNU General Public License as published by<br>
115 the Free Software Foundation; either version 3 of the License, or (at<br>
116 your option) any later version.<br>
118 This program is distributed in the hope that it will be useful, but<br>
119 WITHOUT ANY WARRANTY; without even the implied warranty of<br>
120 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br>
121 General Public License for more details.<br>
123 You should have received a copy of the GNU General Public License<br>
124 along with this program; if not, see http://www.gnu.org/licenses/.<br>
125 </p></div></div></div></body></html>