new version 1.3.1
[sahlberg/ctdb.git] / doc / onnode.1.html
index 27ee5812d59319360ce934c258b809335602dd11..f99bdb94e8398f268a3096d33e7bb7c9b8956f07 100644 (file)
-<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.72.0"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="onnode.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>onnode &#8212; run commands on ctdb nodes</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">onnode NODE COMMAND ...</code> </p></div></div><div class="refsect1" lang="en"><a name="id2490458"></a><h2>DESCRIPTION</h2><p>
+<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 &#8212; 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>
       onnode is a utility to run commands on a specific node of a CTDB
       cluster, or on all nodes.
     </p><p>
-      The NODE option specifies which node to run a command on. You
-      can specify a numeric node number (from 0 to N-1) or the special
-      node 'all'.
+      The NODES option specifies which node to run a command on.  You
+      can specify a numeric node number (from 0 to N-1) or a
+      descriptive node specification (see DESCRIPTIVE NODE
+      SPECIFICATIONS below).  You can also specify lists of nodes,
+      separated by commas, and ranges of numeric node numbers,
+      separated by dashes.  If nodes are specified multiple times then
+      the command will be executed multiple times on those nodes.  The
+      order of nodes is significant.
     </p><p>
       The COMMAND can be any shell command. The onnode utility uses
       ssh or rsh to connect to the remote nodes and run the command.
-      </p><p>
-      If the COMMAND starts with a /, then the command is run via the
-      'at' service. Otherwise the command is run in the foreground.
-    </p></div><div class="refsect1" lang="en"><a name="id2487794"></a><h2>EXAMPLES</h2><p>
+    </p></div><div class="refsect1" title="DESCRIPTIVE NODE SPECIFICATIONS"><a name="id2602547"></a><h2>DESCRIPTIVE NODE SPECIFICATIONS</h2><p>
+      The following descriptive node specification can be used in
+      place of numeric node numbers:
+    </p><div class="variablelist"><dl><dt><span class="term">all</span></dt><dd><p>
+            All nodes.
+         </p></dd><dt><span class="term">any</span></dt><dd><p>
+             A node where ctdbd is running.  This semi-random but
+             there is a bias towards choosing a low numbered node.
+         </p></dd><dt><span class="term">ok | healthy</span></dt><dd><p>
+            All nodes that are not disconnected, banned, disabled or
+            unhealthy.
+         </p></dd><dt><span class="term">con | connected</span></dt><dd><p>
+            All nodes that are not disconnected.
+         </p></dd><dt><span class="term">lvs | lvsmaster</span></dt><dd><p>
+            The current LVS master.
+         </p></dd><dt><span class="term">natgw | natgwlist</span></dt><dd><p>
+            The current NAT gateway.
+         </p></dd><dt><span class="term">rm | recmaster</span></dt><dd><p>
+            The current recovery master.
+         </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>
+            Execute COMMAND in the current working directory on the
+            specified nodes.
+         </p></dd><dt><span class="term">-o &lt;prefix&gt;</span></dt><dd><p>
+           Causes standard output from each node to be saved into a
+           file with name &lt;prefix&gt;.&lt;ip&gt;.
+         </p></dd><dt><span class="term">-p</span></dt><dd><p>
+            Run COMMAND in parallel on the specified nodes.  The
+            default is to run COMMAND sequentially on each node.
+         </p></dd><dt><span class="term">-q</span></dt><dd><p>
+            Do not print node addresses.  Normally, onnode prints
+            informational node addresses if more than one node is
+            specified.  This overrides -v.
+         </p></dd><dt><span class="term">-n</span></dt><dd><p>
+            Allow nodes to be specified by name rather than node
+            numbers.  These nodes don't need to be listed in the nodes
+            file.  You can avoid the nodes file entirely by combining
+            this with <code class="code">-f /dev/null</code>.
+         </p></dd><dt><span class="term">-f &lt;file&gt;</span></dt><dd><p>
+            Specify an alternative nodes file to use instead of the
+            default.  This option overrides the CTDB_NODES_FILE
+            environment variable.  See the discussion of
+            <code class="filename">/etc/ctdb/nodes</code> in the FILES section
+            for more details.
+         </p></dd><dt><span class="term">-v</span></dt><dd><p>
+            Print a node addresses even if only one node is specified.
+            Normally, onnode prints informational node addresses when
+            more than one node is specified.
+         </p></dd><dt><span class="term">-h, --help</span></dt><dd><p>
+            Show a short usage guide.
+         </p></dd></dl></div></div><div class="refsect1" title="EXAMPLES"><a name="id2600855"></a><h2>EXAMPLES</h2><p>
       The following command would show the process ID of ctdb on all nodes
-      </p><pre class="screen">
-onnode all pidof ctdbd
-      </pre><p>
+    </p><pre class="screen">
+      onnode all pidof ctdbd
+    </pre><p>
       The following command would show the last 5 lines of log on each
-      node, preceded by the nodes hostname
-      </p><pre class="screen">
-onnode all "hostname; tail -5 /var/log/log.ctdb"
-      </pre><p>
+      node, preceded by the node's hostname
+    </p><pre class="screen">
+      onnode all "hostname; tail -5 /var/log/log.ctdb"
+    </pre><p>
       The following command would restart the ctdb service on all nodes.
-      </p><pre class="screen">
-onnode all service ctdb restart
-      </pre></div><div class="refsect1" lang="en"><a name="id2488692"></a><h2>SEE ALSO</h2><p>
-      ctdbd(1), ctdb(1), <a href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
-    </p></div><div class="refsect1" lang="en"><a name="id2488704"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
+    </p><pre class="screen">
+      onnode all service ctdb restart
+    </pre><p>
+      The following command would run ./foo in the current working
+      directory, in parallel, on nodes 0, 2, 3 and 4.
+    </p><pre class="screen">
+      onnode -c -p 0,2-4 ./foo
+    </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>
+           Name of alternative nodes file to use instead of the
+            default.  See the discussion of
+            <code class="filename">/etc/ctdb/nodes</code> in the FILES section
+            for more details.
+         </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>
+            Default file containing a list of each node's IP address
+            or hostname.
+         </p><p>
+           Actually, the default is
+            <code class="filename">$<code class="envar">CTDB_BASE</code>/nodes</code>,
+            where <code class="envar">$CTDB_BASE</code> defaults to
+            <code class="filename">/etc/ctdb</code>.  If a relative path is
+            given (via the -f option or <code class="envar">$CTDB_BASE</code>) and
+            no corresponding file exists relative to the current
+            directory then the file is also searched for in the
+            <code class="filename">$<code class="envar">CTDB_BASE</code></code> directory.
+         </p></dd><dt><span class="term"><code class="filename">/etc/ctdb/onnode.conf</code></span></dt><dd><p>
+            If this file exists it is sourced by onnode.  The main
+            purpose is to allow the administrator to set $SSH to
+            something other than "ssh".  In this case the -t option is
+            ignored.  For example, the administrator may choose to use
+            use rsh instead of ssh.
+         </p></dd></dl></div></div><div class="refsect1" title="SEE ALSO"><a name="id2652258"></a><h2>SEE ALSO</h2><p>
+      ctdbd(1), ctdb(1), <a class="ulink" href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
+    </p></div><div class="refsect1" title="COPYRIGHT/LICENSE"><a name="id2652271"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
 Copyright (C) Andrew Tridgell 2007<br>
 Copyright (C) Ronnie sahlberg 2007<br>
+Copyright (C) Martin Schwenke 2008<br>
 <br>
 This program is free software; you can redistribute it and/or modify<br>
 it under the terms of the GNU General Public License as published by<br>
-the Free Software Foundation; either version 2 of the License, or (at<br>
+the Free Software Foundation; either version 3 of the License, or (at<br>
 your option) any later version.<br>
 <br>
 This program is distributed in the hope that it will be useful, but<br>
@@ -41,6 +121,5 @@ MERCHANTABILITY
 General Public License for more details.<br>
 <br>
 You should have received a copy of the GNU General Public License<br>
-along with this program; if not, write to the Free Software<br>
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.<br>
+along with this program; if not, see http://www.gnu.org/licenses/.<br>
 </p></div></div></div></body></html>