| 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.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"><a name="onnode.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>onnode — run commands on CTDB cluster nodes</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">onnode</code> [<em class="replaceable"><code>OPTION</code></em>...] {<em class="replaceable"><code>NODES</code></em>} {<em class="replaceable"><code>COMMAND</code></em>}</p></div></div><div class="refsect1"><a name="idp53127856"></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.
|
|---|
| 4 | </p><p>
|
|---|
| 5 | <em class="replaceable"><code>NODES</code></em> specifies which node(s) to run
|
|---|
| 6 | a command on. See section <em class="citetitle">NODES
|
|---|
| 7 | SPECIFICATION</em> for details.
|
|---|
| 8 | </p><p>
|
|---|
| 9 | <em class="replaceable"><code>COMMAND</code></em> can be any shell command. The
|
|---|
| 10 | onnode utility uses ssh or rsh to connect to the remote nodes
|
|---|
| 11 | and run the command.
|
|---|
| 12 | </p></div><div class="refsect1"><a name="idp52824016"></a><h2>OPTIONS</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">-c</span></dt><dd><p>
|
|---|
| 13 | Execute COMMAND in the current working directory on the
|
|---|
| 14 | specified nodes.
|
|---|
| 15 | </p></dd><dt><span class="term">-f <em class="parameter"><code>FILENAME</code></em></span></dt><dd><p>
|
|---|
| 16 | Specify an alternative nodes FILENAME to use instead of
|
|---|
| 17 | the default. This option overrides the CTDB_NODES_FILE
|
|---|
| 18 | and CTDB_NODES variables. See the discussion of
|
|---|
| 19 | <code class="filename">/usr/local/etc/ctdb/nodes</code> in the FILES section
|
|---|
| 20 | for more details.
|
|---|
| 21 | </p></dd><dt><span class="term">-i</span></dt><dd><p>
|
|---|
| 22 | Keep standard input open, allowing data to be piped to
|
|---|
| 23 | onnode. Normally onnode closes stdin to avoid surprises
|
|---|
| 24 | when scripting. Note that this option is ignored when
|
|---|
| 25 | using <code class="option">-p</code> or if <code class="envar">SSH</code> is set
|
|---|
| 26 | to anything other than "ssh".
|
|---|
| 27 | </p></dd><dt><span class="term">-n</span></dt><dd><p>
|
|---|
| 28 | Allow nodes to be specified by name rather than node
|
|---|
| 29 | numbers. These nodes don't need to be listed in the nodes
|
|---|
| 30 | file. You can avoid the nodes file entirely by combining
|
|---|
| 31 | this with <code class="code">-f /dev/null</code>.
|
|---|
| 32 | </p></dd><dt><span class="term">-o <em class="parameter"><code>PREFIX</code></em></span></dt><dd><p>
|
|---|
| 33 | Causes standard output from each node to be saved into a
|
|---|
| 34 | file with name PREFIX.<em class="replaceable"><code>IP</code></em>.
|
|---|
| 35 | </p></dd><dt><span class="term">-p</span></dt><dd><p>
|
|---|
| 36 | Run COMMAND in parallel on the specified nodes. The
|
|---|
| 37 | default is to run COMMAND sequentially on each node.
|
|---|
| 38 | </p></dd><dt><span class="term">-P</span></dt><dd><p>
|
|---|
| 39 | Push files to nodes. Names of files to push are specified
|
|---|
| 40 | rather than the usual command. Quoting is fragile/broken
|
|---|
| 41 | - filenames with whitespace in them are not supported.
|
|---|
| 42 | </p></dd><dt><span class="term">-q</span></dt><dd><p>
|
|---|
| 43 | Do not print node addresses. Normally, onnode prints
|
|---|
| 44 | informational node addresses if more than one node is
|
|---|
| 45 | specified. This overrides -v.
|
|---|
| 46 | </p></dd><dt><span class="term">-v</span></dt><dd><p>
|
|---|
| 47 | Print node addresses even if only one node is specified.
|
|---|
| 48 | Normally, onnode prints informational node addresses when
|
|---|
| 49 | more than one node is specified.
|
|---|
| 50 | </p></dd><dt><span class="term">-h, --help</span></dt><dd><p>
|
|---|
| 51 | Show a short usage guide.
|
|---|
| 52 | </p></dd></dl></div></div><div class="refsect1"><a name="idp53951872"></a><h2>NODES SPECIFICATION</h2><p>
|
|---|
| 53 | Nodes can be specified via numeric node numbers (from 0 to N-1)
|
|---|
| 54 | or mnemonics. Multiple nodes are specified using lists of
|
|---|
| 55 | nodes, separated by commas, and ranges of numeric node numbers,
|
|---|
| 56 | separated by dashes. If nodes are specified multiple times then
|
|---|
| 57 | the command will be executed multiple times on those nodes. The
|
|---|
| 58 | order of nodes is significant.
|
|---|
| 59 | </p><p>
|
|---|
| 60 | The following mnemonics are available:
|
|---|
| 61 | </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">all</span></dt><dd><p>
|
|---|
| 62 | All nodes.
|
|---|
| 63 | </p></dd><dt><span class="term">any</span></dt><dd><p>
|
|---|
| 64 | A node where ctdbd is running. This semi-random but
|
|---|
| 65 | there is a bias towards choosing a low numbered node.
|
|---|
| 66 | </p></dd><dt><span class="term">ok | healthy</span></dt><dd><p>
|
|---|
| 67 | All nodes that are not disconnected, banned, disabled or
|
|---|
| 68 | unhealthy.
|
|---|
| 69 | </p></dd><dt><span class="term">con | connected</span></dt><dd><p>
|
|---|
| 70 | All nodes that are not disconnected.
|
|---|
| 71 | </p></dd><dt><span class="term">lvs | lvsmaster</span></dt><dd><p>
|
|---|
| 72 | The current LVS master.
|
|---|
| 73 | </p></dd><dt><span class="term">natgw | natgwlist</span></dt><dd><p>
|
|---|
| 74 | The current NAT gateway.
|
|---|
| 75 | </p></dd><dt><span class="term">rm | recmaster</span></dt><dd><p>
|
|---|
| 76 | The current recovery master.
|
|---|
| 77 | </p></dd></dl></div></div><div class="refsect1"><a name="idp49117664"></a><h2>EXAMPLES</h2><p>
|
|---|
| 78 | The following command would show the process ID of ctdbd on all nodes
|
|---|
| 79 | </p><pre class="screen">
|
|---|
| 80 | onnode all ctdb getpid
|
|---|
| 81 | </pre><p>
|
|---|
| 82 | The following command would show the last 5 lines of log on each
|
|---|
| 83 | node, preceded by the node's hostname
|
|---|
| 84 | </p><pre class="screen">
|
|---|
| 85 | onnode all "hostname; tail -5 /usr/local/var/log/log.ctdb"
|
|---|
| 86 | </pre><p>
|
|---|
| 87 | The following command would restart the ctdb service on all
|
|---|
| 88 | nodes, in parallel.
|
|---|
| 89 | </p><pre class="screen">
|
|---|
| 90 | onnode -p all service ctdb restart
|
|---|
| 91 | </pre><p>
|
|---|
| 92 | The following command would run ./foo in the current working
|
|---|
| 93 | directory, in parallel, on nodes 0, 2, 3 and 4.
|
|---|
| 94 | </p><pre class="screen">
|
|---|
| 95 | onnode -c -p 0,2-4 ./foo
|
|---|
| 96 | </pre></div><div class="refsect1"><a name="idp49123120"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">CTDB_BASE</code></span></dt><dd><p>
|
|---|
| 97 | Directory containing CTDB configuration files. The
|
|---|
| 98 | default is <code class="filename">/usr/local/etc/ctdb</code>.
|
|---|
| 99 | </p></dd><dt><span class="term"><code class="envar">CTDB_NODES_FILE</code></span></dt><dd><p>
|
|---|
| 100 | Name of alternative nodes file to use instead of the
|
|---|
| 101 | default. See the <em class="citetitle">FILES</em> section for
|
|---|
| 102 | more details.
|
|---|
| 103 | </p></dd></dl></div></div><div class="refsect1"><a name="idp49128624"></a><h2>FILES</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">/usr/local/etc/ctdb/nodes</code></span></dt><dd><p>
|
|---|
| 104 | Default file containing a list of each node's IP address
|
|---|
| 105 | or hostname.
|
|---|
| 106 | </p><p>
|
|---|
| 107 | As above, a file specified via the <code class="option">-f</code> or
|
|---|
| 108 | <code class="envar">CTDB_NODES_FILE</code> is given precedence. If a
|
|---|
| 109 | relative path is specified and no corresponding file
|
|---|
| 110 | exists relative to the current directory then the file is
|
|---|
| 111 | also searched for in the <code class="filename">$CTDB_BASE</code>
|
|---|
| 112 | directory.
|
|---|
| 113 | </p><p>
|
|---|
| 114 | If <code class="envar">CTDB_NODES_FILE</code> is not set and
|
|---|
| 115 | <code class="envar">CTDB_NODES</code> is set in configuration then the
|
|---|
| 116 | file pointed to by <code class="envar">CTDB_NODES</code> is used.
|
|---|
| 117 | </p><p>
|
|---|
| 118 | Otherwise the default is
|
|---|
| 119 | <code class="filename">$CTDB_BASE/nodes</code>, where
|
|---|
| 120 | <code class="envar">CTDB_BASE</code> defaults to
|
|---|
| 121 | <code class="filename">/usr/local/etc/ctdb</code>.
|
|---|
| 122 | </p></dd><dt><span class="term"><code class="filename">/usr/local/etc/ctdb/onnode.conf</code></span></dt><dd><p>
|
|---|
| 123 | If this file exists it is sourced by onnode. The main
|
|---|
| 124 | purpose is to allow the administrator to set
|
|---|
| 125 | <code class="envar">SSH</code> to something other than "ssh". In this
|
|---|
| 126 | case the -t option is ignored. For example, the
|
|---|
| 127 | administrator may choose to use use rsh instead of ssh.
|
|---|
| 128 | </p></dd></dl></div></div><div class="refsect1"><a name="idp49145264"></a><h2>SEE ALSO</h2><p>
|
|---|
| 129 | <span class="citerefentry"><span class="refentrytitle">ctdb</span>(7)</span>,
|
|---|
| 130 |
|
|---|
| 131 | <a class="ulink" href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
|
|---|
| 132 | </p></div></div></body></html>
|
|---|