1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>ctdb</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="ctdb.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ctdb — CTDB management utility</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">ctdb</code> [<em class="replaceable"><code>OPTION</code></em>...] {<em class="replaceable"><code>COMMAND</code></em>} [<em class="replaceable"><code>COMMAND-ARGS</code></em>]</p></div></div><div class="refsect1"><a name="idm140001401982336"></a><h2>DESCRIPTION</h2><p>
2 ctdb is a utility to view and manage a CTDB cluster.
4 The following terms are used when referring to nodes in a
6 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">PNN</span></dt><dd><p>
7 Physical Node Number. The physical node number is an
8 integer that describes the node in the cluster. The
9 first node has physical node number 0. in a cluster.
10 </p></dd><dt><span class="term">PNN-LIST</span></dt><dd><p>
11 This is either a single PNN, a comma-separate list of PNNs
13 </p></dd></dl></div><p>
15 Commands that reference a database use the following terms:
16 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">DB</span></dt><dd><p>
17 This is either a database name, such as
18 <code class="filename">locking.tdb</code> or a database ID such
20 </p></dd><dt><span class="term">DB-LIST</span></dt><dd><p>
21 A space separated list of at least one
22 <em class="parameter"><code>DB</code></em>.
23 </p></dd></dl></div><p>
24 </p></div><div class="refsect1"><a name="idm140001402008576"></a><h2>OPTIONS</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">-n <em class="parameter"><code>PNN-LIST</code></em></span></dt><dd><p>
25 The nodes specified by PNN-LIST should be queried for the
26 requested information. Default is to query the daemon
27 running on the local host.
28 </p></dd><dt><span class="term">-Y</span></dt><dd><p>
29 Produce output in machine readable form for easier parsing
30 by scripts. This uses a field delimiter of ':'. Not all
31 commands support this option.
32 </p></dd><dt><span class="term">-x <em class="parameter"><code>SEPARATOR</code></em></span></dt><dd><p>
33 Use SEPARATOR to delimit fields in machine readable output.
35 </p></dd><dt><span class="term">-X</span></dt><dd><p>
36 Produce output in machine readable form for easier parsing
37 by scripts. This uses a field delimiter of '|'. Not all
38 commands support this option.
40 This is equivalent to "-x|" and avoids some shell quoting
42 </p></dd><dt><span class="term">-t <em class="parameter"><code>TIMEOUT</code></em></span></dt><dd><p>
43 Indicates that ctdb should wait up to TIMEOUT seconds for
44 a response to most commands sent to the CTDB daemon. The
45 default is 10 seconds.
46 </p></dd><dt><span class="term">-T <em class="parameter"><code>TIMELIMIT</code></em></span></dt><dd><p>
47 Indicates that TIMELIMIT is the maximum run time (in
48 seconds) for the ctdb command. When TIMELIMIT is exceeded
49 the ctdb command will terminate with an error. The default
51 </p></dd><dt><span class="term">-? --help</span></dt><dd><p>
52 Print some help text to the screen.
53 </p></dd><dt><span class="term">--usage</span></dt><dd><p>
54 Print useage information to the screen.
55 </p></dd><dt><span class="term">-d --debug=<em class="parameter"><code>DEBUGLEVEL</code></em></span></dt><dd><p>
56 Change the debug level for the command. Default is NOTICE (2).
57 </p></dd><dt><span class="term">--socket=<em class="parameter"><code>FILENAME</code></em></span></dt><dd><p>
58 Specify that FILENAME is the name of the Unix domain
59 socket to use when connecting to the local CTDB
60 daemon. The default is
61 <code class="filename">/usr/local/var/run/ctdb/ctdbd.socket</code>.
62 </p></dd></dl></div></div><div class="refsect1"><a name="idm140001397612864"></a><h2>ADMINISTRATIVE COMMANDS</h2><p>
63 These are commands used to monitor and administer a CTDB cluster.
64 </p><div class="refsect2"><a name="idm140001397611712"></a><h3>pnn</h3><p>
65 This command displays the PNN of the current node.
66 </p></div><div class="refsect2"><a name="idm140001397610560"></a><h3>xpnn</h3><p>
67 This command displays the PNN of the current node without
68 contacting the CTDB daemon. It parses the nodes file
69 directly, so can produce unexpected output if the nodes file
70 has been edited but has not been reloaded.
71 </p></div><div class="refsect2"><a name="idm140001397609136"></a><h3>status</h3><p>
72 This command shows the current status of all CTDB nodes based
73 on information from the queried node.
75 Note: If the the queried node is INACTIVE then the status
77 </p><div class="refsect3"><a name="idm140001402039168"></a><h4>Node status</h4><p>
78 This includes the number of physical nodes and the status of
79 each node. See <span class="citerefentry"><span class="refentrytitle">ctdb</span>(7)</span> for information
81 </p></div><div class="refsect3"><a name="idm140001402036912"></a><h4>Generation</h4><p>
82 The generation id is a number that indicates the current generation
83 of a cluster instance. Each time a cluster goes through a
84 reconfiguration or a recovery its generation id will be changed.
86 This number does not have any particular meaning other than
87 to keep track of when a cluster has gone through a
88 recovery. It is a random number that represents the current
89 instance of a ctdb cluster and its databases. The CTDB
90 daemon uses this number internally to be able to tell when
91 commands to operate on the cluster and the databases was
92 issued in a different generation of the cluster, to ensure
93 that commands that operate on the databases will not survive
94 across a cluster database recovery. After a recovery, all
95 old outstanding commands will automatically become invalid.
97 Sometimes this number will be shown as "INVALID". This only means that
98 the ctdbd daemon has started but it has not yet merged with the cluster through a recovery.
99 All nodes start with generation "INVALID" and are not assigned a real
100 generation id until they have successfully been merged with a cluster
102 </p></div><div class="refsect3"><a name="idm140001402033136"></a><h4>Virtual Node Number (VNN) map</h4><p>
103 Consists of the number of virtual nodes and mapping from
104 virtual node numbers to physical node numbers. Virtual
105 nodes host CTDB databases. Only nodes that are
106 participating in the VNN map can become lmaster or dmaster
107 for database records.
108 </p></div><div class="refsect3"><a name="idm140001402031664"></a><h4>Recovery mode</h4><p>
109 This is the current recovery mode of the cluster. There are two possible modes:
111 NORMAL - The cluster is fully operational.
113 RECOVERY - The cluster databases have all been frozen, pausing all services while the cluster awaits a recovery process to complete. A recovery process should finish within seconds. If a cluster is stuck in the RECOVERY state this would indicate a cluster malfunction which needs to be investigated.
115 Once the recovery master detects an inconsistency, for example a node
116 becomes disconnected/connected, the recovery daemon will trigger a
117 cluster recovery process, where all databases are remerged across the
118 cluster. When this process starts, the recovery master will first
119 "freeze" all databases to prevent applications such as samba from
120 accessing the databases and it will also mark the recovery mode as
123 When the CTDB daemon starts up, it will start in RECOVERY
124 mode. Once the node has been merged into a cluster and all
125 databases have been recovered, the node mode will change into
126 NORMAL mode and the databases will be "thawed", allowing samba
127 to access the databases again.
128 </p></div><div class="refsect3"><a name="idm140001402027760"></a><h4>Recovery master</h4><p>
129 This is the cluster node that is currently designated as the recovery master. This node is responsible of monitoring the consistency of the cluster and to perform the actual recovery process when reqired.
131 Only one node at a time can be the designated recovery master. Which
132 node is designated the recovery master is decided by an election
133 process in the recovery daemons running on each node.
134 </p></div><div class="refsect3"><a name="idm140001402025760"></a><h4>Example</h4><pre class="screen">
137 pnn:0 192.168.2.200 OK (THIS NODE)
138 pnn:1 192.168.2.201 OK
139 pnn:2 192.168.2.202 OK
140 pnn:3 192.168.2.203 OK
141 Generation:1362079228
147 Recovery mode:NORMAL (0)
149 </pre></div></div><div class="refsect2"><a name="idm140001402023856"></a><h3>nodestatus [<span class="optional"><em class="parameter"><code>PNN-LIST</code></em></span>]</h3><p>
150 This command is similar to the <span class="command"><strong>status</strong></span>
151 command. It displays the "node status" subset of output. The
152 main differences are:
153 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
154 The exit code is the bitwise-OR of the flags for each
155 specified node, while <span class="command"><strong>ctdb status</strong></span> exits
156 with 0 if it was able to retrieve status for all nodes.
157 </p></li><li class="listitem"><p>
158 <span class="command"><strong>ctdb status</strong></span> provides status information
159 for all nodes. <span class="command"><strong>ctdb nodestatus</strong></span>
160 defaults to providing status for only the current node.
161 If PNN-LIST is provided then status is given for
162 the indicated node(s).
163 </p></li></ul></div><p>
164 A common invocation in scripts is <span class="command"><strong>ctdb nodestatus
165 all</strong></span> to check whether all nodes in a cluster are
167 </p><div class="refsect3"><a name="idm140001396491728"></a><h4>Example</h4><pre class="screen">
169 pnn:0 10.0.0.30 OK (THIS NODE)
171 # ctdb nodestatus all
173 pnn:0 10.0.0.30 OK (THIS NODE)
175 </pre></div></div><div class="refsect2"><a name="idm140001396490032"></a><h3>recmaster</h3><p>
176 This command shows the pnn of the node which is currently the recmaster.
178 Note: If the the queried node is INACTIVE then the status
179 might not be current.
180 </p></div><div class="refsect2"><a name="idm140001396488288"></a><h3>uptime</h3><p>
181 This command shows the uptime for the ctdb daemon. When the last recovery or ip-failover completed and how long it took. If the "duration" is shown as a negative number, this indicates that there is a recovery/failover in progress and it started that many seconds ago.
182 </p><div class="refsect3"><a name="idm140001396486976"></a><h4>Example</h4><pre class="screen">
184 Current time of node : Thu Oct 29 10:38:54 2009
185 Ctdbd start time : (000 16:54:28) Wed Oct 28 17:44:26 2009
186 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
187 Duration of last recovery/failover: 2.248552 seconds
188 </pre></div></div><div class="refsect2"><a name="idm140001396485152"></a><h3>listnodes</h3><p>
189 This command shows lists the ip addresses of all the nodes in the cluster.
190 </p><div class="refsect3"><a name="idm140001396484032"></a><h4>Example</h4><pre class="screen">
196 </pre></div></div><div class="refsect2"><a name="idm140001396482416"></a><h3>natgwlist</h3><p>
197 Show the current NAT gateway master and the status of all
198 nodes in the current NAT gateway group. See the
199 <em class="citetitle">NAT GATEWAY</em> section in
200 <span class="citerefentry"><span class="refentrytitle">ctdb</span>(7)</span> for more details.
201 </p><div class="refsect3"><a name="idm140001396479984"></a><h4>Example</h4><pre class="screen">
205 pnn:0 192.168.2.200 OK (THIS NODE)
206 pnn:1 192.168.2.201 OK
207 pnn:2 192.168.2.202 OK
208 pnn:3 192.168.2.203 OK
209 </pre></div></div><div class="refsect2"><a name="idm140001396478272"></a><h3>ping</h3><p>
210 This command will "ping" specified CTDB nodes in the cluster
211 to verify that they are running.
212 </p><div class="refsect3"><a name="idm140001396477136"></a><h4>Example</h4><pre class="screen">
214 response from 0 time=0.000054 sec (3 clients)
215 </pre></div></div><div class="refsect2"><a name="idm140001396475616"></a><h3>ifaces</h3><p>
216 This command will display the list of network interfaces, which could
217 host public addresses, along with their status.
218 </p><div class="refsect3"><a name="idm140001396474448"></a><h4>Example</h4><pre class="screen">
221 name:eth5 link:up references:2
222 name:eth4 link:down references:0
223 name:eth3 link:up references:1
224 name:eth2 link:up references:1
227 |Name|LinkStatus|References|
232 </pre></div></div><div class="refsect2"><a name="idm140001396472656"></a><h3>ip</h3><p>
233 This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip. By default this command will ONLY show those public addresses that are known to the node itself. To see the full list of all public ips across the cluster you must use "ctdb ip all".
234 </p><div class="refsect3"><a name="idm140001396471280"></a><h4>Example</h4><pre class="screen">
237 172.31.91.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
238 172.31.91.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
239 172.31.91.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
240 172.31.91.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
241 172.31.92.82 node[1] active[] available[eth5] configured[eth4,eth5]
242 172.31.92.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
243 172.31.92.84 node[1] active[] available[eth5] configured[eth4,eth5]
244 172.31.92.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
247 |Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|
248 |172.31.91.82|1||eth2,eth3|eth2,eth3|
249 |172.31.91.83|0|eth3|eth2,eth3|eth2,eth3|
250 |172.31.91.84|1||eth2,eth3|eth2,eth3|
251 |172.31.91.85|0|eth2|eth2,eth3|eth2,eth3|
252 |172.31.92.82|1||eth5|eth4,eth5|
253 |172.31.92.83|0|eth5|eth5|eth4,eth5|
254 |172.31.92.84|1||eth5|eth4,eth5|
255 |172.31.92.85|0|eth5|eth5|eth4,eth5|
256 </pre></div></div><div class="refsect2"><a name="idm140001396467728"></a><h3>ipinfo <em class="parameter"><code>IP</code></em></h3><p>
257 This command will display details about the specified public addresses.
258 </p><div class="refsect3"><a name="idm140001396466112"></a><h4>Example</h4><pre class="screen">
259 # ctdb ipinfo 172.31.92.85
260 Public IP[172.31.92.85] info on node 0
264 Interface[1]: Name:eth4 Link:down References:0
265 Interface[2]: Name:eth5 Link:up References:2 (active)
266 </pre></div></div><div class="refsect2"><a name="idm140001396464368"></a><h3>scriptstatus</h3><p>
267 This command displays which scripts where run in the previous monitoring cycle and the result of each script. If a script failed with an error, causing the node to become unhealthy, the output from that script is also shown.
268 </p><div class="refsect3"><a name="idm140001396463088"></a><h4>Example</h4><pre class="screen">
270 7 scripts were executed last monitoring cycle
271 00.ctdb Status:OK Duration:0.056 Tue Mar 24 18:56:57 2009
272 10.interface Status:OK Duration:0.077 Tue Mar 24 18:56:57 2009
273 11.natgw Status:OK Duration:0.039 Tue Mar 24 18:56:57 2009
274 20.multipathd Status:OK Duration:0.038 Tue Mar 24 18:56:57 2009
275 31.clamd Status:DISABLED
276 40.vsftpd Status:OK Duration:0.045 Tue Mar 24 18:56:57 2009
277 41.httpd Status:OK Duration:0.039 Tue Mar 24 18:56:57 2009
278 50.samba Status:ERROR Duration:0.082 Tue Mar 24 18:56:57 2009
279 OUTPUT:ERROR: Samba tcp port 445 is not responding
280 </pre></div></div><div class="refsect2"><a name="idm140001396460864"></a><h3>disablescript <em class="parameter"><code>SCRIPT</code></em></h3><p>
281 This command is used to disable an eventscript.
283 This will take effect the next time the eventscripts are being executed so it can take a short while until this is reflected in 'scriptstatus'.
284 </p></div><div class="refsect2"><a name="idm140001396458656"></a><h3>enablescript <em class="parameter"><code>SCRIPT</code></em></h3><p>
285 This command is used to enable an eventscript.
287 This will take effect the next time the eventscripts are being executed so it can take a short while until this is reflected in 'scriptstatus'.
288 </p></div><div class="refsect2"><a name="idm140001396456448"></a><h3>listvars</h3><p>
289 List all tuneable variables, except the values of the obsolete tunables
290 like VacuumMinInterval. The obsolete tunables can be retrieved only
291 explicitly with the "ctdb getvar" command.
292 </p><div class="refsect3"><a name="idm140001396455216"></a><h4>Example</h4><pre class="screen">
295 SeqnumInterval = 1000
298 KeepaliveInterval = 5
305 TickleUpdateInterval = 20
306 EventScriptTimeout = 30
307 MonitorTimeoutCount = 1
308 RecoveryGracePeriod = 120
309 RecoveryBanPeriod = 300
310 DatabaseHashSize = 100001
312 RerecoveryTimeout = 10
316 ReclockPingPeriod = 60
318 DisableIPFailover = 0
319 VerboseMemoryNames = 0
323 RecLockLatencyMs = 1000
324 RecoveryDropAllIPs = 120
326 VacuumMaxRunTime = 30
329 VacuumFastPathCount = 60
330 MaxQueueDropMsg = 1000000
332 AllowUnhealthyDBRead = 0
333 StatHistoryInterval = 1
334 DeferredAttachTO = 120
335 AllowClientDBAttach = 1
336 RecoverPDBBySeqNum = 0
337 </pre></div></div><div class="refsect2"><a name="idm140001396451152"></a><h3>getvar <em class="parameter"><code>NAME</code></em></h3><p>
338 Get the runtime value of a tuneable variable.
339 </p><div class="refsect3"><a name="idm140001396449632"></a><h4>Example</h4><pre class="screen">
340 # ctdb getvar MaxRedirectCount
342 </pre></div></div><div class="refsect2"><a name="idm140001396448112"></a><h3>setvar <em class="parameter"><code>NAME</code></em> <em class="parameter"><code>VALUE</code></em></h3><p>
343 Set the runtime value of a tuneable variable.
345 Example: ctdb setvar MaxRedirectCount 5
346 </p></div><div class="refsect2"><a name="idm140001396445456"></a><h3>lvsmaster</h3><p>
347 This command shows which node is currently the LVSMASTER. The
348 LVSMASTER is the node in the cluster which drives the LVS system and
349 which receives all incoming traffic from clients.
351 LVS is the mode where the entire CTDB/Samba cluster uses a single
352 ip address for the entire cluster. In this mode all clients connect to
353 one specific node which will then multiplex/loadbalance the clients
354 evenly onto the other nodes in the cluster. This is an alternative to using
355 public ip addresses. See the manpage for ctdbd for more information
357 </p></div><div class="refsect2"><a name="idm140001396443328"></a><h3>lvs</h3><p>
358 This command shows which nodes in the cluster are currently active in the
359 LVS configuration. I.e. which nodes we are currently loadbalancing
360 the single ip address across.
362 LVS will by default only loadbalance across those nodes that are both
363 LVS capable and also HEALTHY. Except if all nodes are UNHEALTHY in which
364 case LVS will loadbalance across all UNHEALTHY nodes as well.
365 LVS will never use nodes that are DISCONNECTED, STOPPED, BANNED or
369 </p><pre class="screen">
372 </pre></div><div class="refsect2"><a name="idm140001396440288"></a><h3>getcapabilities</h3><p>
373 This command shows the capabilities of the current node. See
374 the <em class="citetitle">CAPABILITIES</em> section in
375 <span class="citerefentry"><span class="refentrytitle">ctdb</span>(7)</span> for more details.
378 </p><pre class="screen">
382 </pre></div><div class="refsect2"><a name="idm140001396436848"></a><h3>statistics</h3><p>
383 Collect statistics from the CTDB daemon about
384 how many calls it has served. Information about
385 various fields in statistics can be found in
386 <span class="citerefentry"><span class="refentrytitle">ctdb-statistics</span>(7)</span>.
387 </p><div class="refsect3"><a name="idm140001396434752"></a><h4>Example</h4><pre class="screen">
393 client_packets_sent 360489
394 client_packets_recv 360466
395 node_packets_sent 480931
396 node_packets_recv 240120
397 keepalive_packets_sent 4
398 keepalive_packets_recv 3
419 pending_lockwait_calls 0
422 max_call_latency 4.948321 sec
423 max_lockwait_latency 0.000000 sec
424 </pre></div></div><div class="refsect2"><a name="idm140001396430880"></a><h3>statisticsreset</h3><p>
425 This command is used to clear all statistics counters in a node.
427 Example: ctdb statisticsreset
428 </p></div><div class="refsect2"><a name="idm140001396429248"></a><h3>dbstatistics <em class="parameter"><code>DB</code></em></h3><p>
429 Display statistics about the database DB. Information
430 about various fields in dbstatistics can be found in
431 <span class="citerefentry"><span class="refentrytitle">ctdb-statistics</span>(7)</span>.
432 </p><div class="refsect3"><a name="idm140001396426704"></a><h4>Example</h4><pre class="screen">
433 # ctdb dbstatistics locking.tdb
434 DB Statistics: locking.tdb
442 hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
443 lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
444 locks_latency MIN/AVG/MAX 0.001066/0.012686/4.202292 sec out of 14356
446 Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
447 </pre></div></div><div class="refsect2"><a name="idm140001396424592"></a><h3>getreclock</h3><p>
448 Show the name of the recovery lock file, if any.
451 </p><pre class="screen">
452 Reclock file:/clusterfs/.ctdb/recovery.lock
453 </pre></div><div class="refsect2"><a name="idm140001396422432"></a><h3>
454 setreclock [<span class="optional"><em class="parameter"><code>FILE</code></em></span>]
456 FILE specifies the name of the recovery lock file. If the
457 recovery lock file is changed at run-time then this will cause
458 a recovery, which in turn causes the recovery lock to be
461 If no FILE is specified then a recovery lock file will no
464 This command only affects the run-time setting of a single
465 CTDB node. This setting <span class="emphasis"><em>must</em></span> be changed
466 on all nodes simultaneously. For information about configuring
467 the recovery lock file please see the
468 <em class="citetitle">CTDB_RECOVERY_LOCK</em> entry in
469 <span class="citerefentry"><span class="refentrytitle">ctdbd.conf</span>(5)</span> and the
470 <em class="citetitle">--reclock</em> entry in
471 <span class="citerefentry"><span class="refentrytitle">ctdbd</span>(1)</span>. For information
472 about the recovery lock please see the <em class="citetitle">RECOVERY
474 <span class="citerefentry"><span class="refentrytitle">ctdb</span>(7)</span>.
475 </p></div><div class="refsect2"><a name="idm140001396415008"></a><h3>getdebug</h3><p>
476 Get the current debug level for the node. the debug level controls what information is written to the log file.
478 The debug levels are mapped to the corresponding syslog levels.
479 When a debug level is set, only those messages at that level and higher
480 levels will be printed.
482 The list of debug levels from highest to lowest are :
484 ERR WARNING NOTICE INFO DEBUG
485 </p></div><div class="refsect2"><a name="idm140001396412368"></a><h3>setdebug <em class="parameter"><code>DEBUGLEVEL</code></em></h3><p>
486 Set the debug level of a node. This controls what information will be logged.
488 The debuglevel is one of ERR WARNING NOTICE INFO DEBUG
489 </p></div><div class="refsect2"><a name="idm140001396410240"></a><h3>getpid</h3><p>
490 This command will return the process id of the ctdb daemon.
491 </p></div><div class="refsect2"><a name="idm140001396409088"></a><h3>disable</h3><p>
492 This command is used to administratively disable a node in the cluster.
493 A disabled node will still participate in the cluster and host
494 clustered TDB records but its public ip address has been taken over by
495 a different node and it no longer hosts any services.
496 </p></div><div class="refsect2"><a name="idm140001396407648"></a><h3>enable</h3><p>
497 Re-enable a node that has been administratively disabled.
498 </p></div><div class="refsect2"><a name="idm140001396406496"></a><h3>stop</h3><p>
499 This command is used to administratively STOP a node in the cluster.
500 A STOPPED node is connected to the cluster but will not host any
501 public ip addresse, nor does it participate in the VNNMAP.
502 The difference between a DISABLED node and a STOPPED node is that
503 a STOPPED node does not host any parts of the database which means
504 that a recovery is required to stop/continue nodes.
505 </p></div><div class="refsect2"><a name="idm140001396404944"></a><h3>continue</h3><p>
506 Re-start a node that has been administratively stopped.
507 </p></div><div class="refsect2"><a name="idm140001396403792"></a><h3>addip <em class="parameter"><code>IPADDR</code></em>/<em class="parameter"><code>mask</code></em> <em class="parameter"><code>IFACE</code></em></h3><p>
508 This command is used to add a new public ip to a node during runtime.
509 This allows public addresses to be added to a cluster without having
510 to restart the ctdb daemons.
512 Note that this only updates the runtime instance of ctdb. Any changes will be lost next time ctdb is restarted and the public addresses file is re-read.
513 If you want this change to be permanent you must also update the public addresses file manually.
514 </p></div><div class="refsect2"><a name="idm140001396400048"></a><h3>delip <em class="parameter"><code>IPADDR</code></em></h3><p>
515 This command is used to remove a public ip from a node during runtime.
516 If this public ip is currently hosted by the node it being removed from, the ip will first be failed over to another node, if possible, before it is removed.
518 Note that this only updates the runtime instance of ctdb. Any changes will be lost next time ctdb is restarted and the public addresses file is re-read.
519 If you want this change to be permanent you must also update the public addresses file manually.
520 </p></div><div class="refsect2"><a name="idm140001396397488"></a><h3>moveip <em class="parameter"><code>IPADDR</code></em> <em class="parameter"><code>PNN</code></em></h3><p>
521 This command can be used to manually fail a public ip address to a
524 In order to manually override the "automatic" distribution of public
525 ip addresses that ctdb normally provides, this command only works
526 when you have changed the tunables for the daemon to:
531 </p></div><div class="refsect2"><a name="idm140001396393728"></a><h3>shutdown</h3><p>
532 This command will shutdown a specific CTDB daemon.
533 </p></div><div class="refsect2"><a name="idm140001396392576"></a><h3>setlmasterrole on|off</h3><p>
534 This command is used ot enable/disable the LMASTER capability for a node at runtime. This capability determines whether or not a node can be used as an LMASTER for records in the database. A node that does not have the LMASTER capability will not show up in the vnnmap.
536 Nodes will by default have this capability, but it can be stripped off nodes by the setting in the sysconfig file or by using this command.
538 Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
540 See also "ctdb getcapabilities"
541 </p></div><div class="refsect2"><a name="idm140001396389696"></a><h3>setrecmasterrole on|off</h3><p>
542 This command is used ot enable/disable the RECMASTER capability for a node at runtime. This capability determines whether or not a node can be used as an RECMASTER for the cluster. A node that does not have the RECMASTER capability can not win a recmaster election. A node that already is the recmaster for the cluster when the capability is stripped off the node will remain the recmaster until the next cluster election.
544 Nodes will by default have this capability, but it can be stripped off nodes by the setting in the sysconfig file or by using this command.
546 See also "ctdb getcapabilities"
547 </p></div><div class="refsect2"><a name="idm140001396387168"></a><h3>reloadnodes</h3><p>
548 This command is used when adding new nodes, or removing
549 existing nodes from an existing cluster.
551 Procedure to add nodes:
552 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
553 To expand an existing cluster, first ensure with
554 <span class="command"><strong>ctdb status</strong></span> that all nodes are up and
555 running and that they are all healthy. Do not try to
556 expand a cluster unless it is completely healthy!
557 </p></li><li class="listitem"><p>
558 On all nodes, edit <code class="filename">/usr/local/etc/ctdb/nodes</code>
559 and <span class="emphasis"><em>add the new nodes at the end of this
561 </p></li><li class="listitem"><p>
562 Verify that all the nodes have identical
563 <code class="filename">/usr/local/etc/ctdb/nodes</code> files after adding
565 </p></li><li class="listitem"><p>
566 Run <span class="command"><strong>ctdb reloadnodes</strong></span> to force all nodes
567 to reload the nodes file.
568 </p></li><li class="listitem"><p>
569 Use <span class="command"><strong>ctdb status</strong></span> on all nodes and verify
570 that they now show the additional nodes.
571 </p></li><li class="listitem"><p>
572 Install and configure the new node and bring it online.
573 </p></li></ol></div><p>
574 Procedure to remove nodes:
575 </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
576 To remove nodes from an existing cluster, first ensure
577 with <span class="command"><strong>ctdb status</strong></span> that all nodes, except
578 the node to be deleted, are up and running and that they
579 are all healthy. Do not try to remove nodes from a
580 cluster unless the cluster is completely healthy!
581 </p></li><li class="listitem"><p>
582 Shutdown and power off the node to be removed.
583 </p></li><li class="listitem"><p>
584 On all other nodes, edit the
585 <code class="filename">/usr/local/etc/ctdb/nodes</code> file and
586 <span class="emphasis"><em>comment out</em></span> the nodes to be removed.
587 <span class="emphasis"><em>Do not delete the lines for the deleted
588 nodes</em></span>, just comment them out by adding a '#' at
589 the beginning of the lines.
590 </p></li><li class="listitem"><p>
591 Run <span class="command"><strong>ctdb reloadnodes</strong></span> to force all nodes
592 to reload the nodes file.
593 </p></li><li class="listitem"><p>
594 Use <span class="command"><strong>ctdb status</strong></span> on all nodes and verify
595 that the deleted nodes are no longer listed.
596 </p></li></ol></div></div><div class="refsect2"><a name="idm140001396367344"></a><h3>
598 [<span class="optional"><em class="parameter"><code>PNN-LIST</code></em></span>]
600 This command reloads the public addresses configuration file
601 on the specified nodes. When it completes addresses will be
602 reconfigured and reassigned across the cluster as necessary.
603 </p></div><div class="refsect2"><a name="idm140001396365232"></a><h3>getdbmap</h3><p>
604 This command lists all clustered TDB databases that the CTDB daemon has attached to. Some databases are flagged as PERSISTENT, this means that the database stores data persistently and the data will remain across reboots. One example of such a database is secrets.tdb where information about how the cluster was joined to the domain is stored.
606 If a PERSISTENT database is not in a healthy state the database is
607 flagged as UNHEALTHY. If there's at least one completely healthy node running in
608 the cluster, it's possible that the content is restored by a recovery
609 run automaticly. Otherwise an administrator needs to analyze the
612 See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
613 "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
614 and (if samba or tdb-utils are installed) "tdbtool check".
616 Most databases are not persistent and only store the state information that the currently running samba daemons need. These databases are always wiped when ctdb/samba starts and when a node is rebooted.
617 </p><div class="refsect3"><a name="idm140001396361920"></a><h4>Example</h4><pre class="screen">
619 Number of databases:10
620 dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
621 dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
622 dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
623 dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
624 dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
625 dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
626 dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
627 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
628 dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
629 dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
631 # ctdb getdbmap # example for unhealthy database
632 Number of databases:1
633 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
636 |ID|Name|Path|Persistent|Unhealthy|
637 |0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
638 </pre></div></div><div class="refsect2"><a name="idm140001396359168"></a><h3>
640 <em class="parameter"><code>DB</code></em>
641 <em class="parameter"><code>FILE</code></em>
643 Copy the contents of database DB to FILE. FILE can later be
644 read back using <span class="command"><strong>restoredb</strong></span>. This is mainly
645 useful for backing up persistent databases such as
646 <code class="filename">secrets.tdb</code> and similar.
647 </p></div><div class="refsect2"><a name="idm140001396355344"></a><h3>
649 <em class="parameter"><code>FILE</code></em>
650 [<span class="optional"><em class="parameter"><code>DB</code></em></span>]
652 This command restores a persistent database that was
653 previously backed up using backupdb. By default the data will
654 be restored back into the same database as it was created
655 from. By specifying dbname you can restore the data into a
657 </p></div><div class="refsect2"><a name="idm140001396352528"></a><h3>setdbreadonly <em class="parameter"><code>DB</code></em></h3><p>
658 This command will enable the read-only record support for a
659 database. This is an experimental feature to improve
660 performance for contended records primarily in locking.tdb and
661 brlock.tdb. When enabling this feature you must set it on all
662 nodes in the cluster.
663 </p></div><div class="refsect2"><a name="idm140001396350592"></a><h3>setdbsticky <em class="parameter"><code>DB</code></em></h3><p>
664 This command will enable the sticky record support for the
665 specified database. This is an experimental feature to
666 improve performance for contended records primarily in
667 locking.tdb and brlock.tdb. When enabling this feature you
668 must set it on all nodes in the cluster.
669 </p></div></div><div class="refsect1"><a name="idm140001396348512"></a><h2>INTERNAL COMMANDS</h2><p>
670 Internal commands are used by CTDB's scripts and are not
671 required for managing a CTDB cluster. Their parameters and
672 behaviour are subject to change.
673 </p><div class="refsect2"><a name="idm140001396347296"></a><h3>gettickles <em class="parameter"><code>IPADDR</code></em></h3><p>
674 Show TCP connections that are registered with CTDB to be
675 "tickled" if there is a failover.
676 </p></div><div class="refsect2"><a name="idm140001396345536"></a><h3>gratiousarp <em class="parameter"><code>IPADDR</code></em> <em class="parameter"><code>INTERFACE</code></em></h3><p>
677 Send out a gratious ARP for the specified interface through
678 the specified interface. This command is mainly used by the
680 </p></div><div class="refsect2"><a name="idm140001396343104"></a><h3>killtcp</h3><p>
681 Read a list of TCP connections, one per line, from standard
682 input and terminate each connection. A connection is
684 </p><pre class="synopsis">
685 <em class="parameter"><code>SRC-IPADDR</code></em>:<em class="parameter"><code>SRC-PORT</code></em> <em class="parameter"><code>DST-IPADDR</code></em>:<em class="parameter"><code>DST-PORT</code></em>
687 Each connection is terminated by issuing a TCP RST to the
688 SRC-IPADDR:SRC-PORT endpoint.
690 A single connection can be specified on the command-line
691 rather than on standard input.
692 </p></div><div class="refsect2"><a name="idm140001396337680"></a><h3>
693 pdelete <em class="parameter"><code>DB</code></em> <em class="parameter"><code>KEY</code></em>
696 </p></div><div class="refsect2"><a name="idm140001396335280"></a><h3>
697 pfetch <em class="parameter"><code>DB</code></em> <em class="parameter"><code>KEY</code></em>
699 Print the value associated with KEY in DB.
700 </p></div><div class="refsect2"><a name="idm140001396332880"></a><h3>
702 <em class="parameter"><code>DB</code></em>
703 <em class="parameter"><code>KEY</code></em>
704 <em class="parameter"><code>FILE</code></em>
706 Store KEY in DB with contents of FILE as the associated value.
707 </p></div><div class="refsect2"><a name="idm140001396329776"></a><h3>
709 <em class="parameter"><code>DB</code></em>
710 [<span class="optional"><em class="parameter"><code>FILE</code></em></span>]
712 Read a list of key-value pairs, one per line from FILE, and
713 store them in DB using a single transaction. An empty value
714 is equivalent to deleting the given key.
716 The key and value should be separated by spaces or tabs. Each
717 key/value should be a printable string enclosed in
719 </p></div><div class="refsect2"><a name="idm140001396326512"></a><h3>runstate [setup|first_recovery|startup|running]</h3><p>
720 Print the runstate of the specified node. Runstates are used
721 to serialise important state transitions in CTDB, particularly
724 If one or more optional runstate arguments are specified then
725 the node must be in one of these runstates for the command to
727 </p><div class="refsect3"><a name="idm140001396324784"></a><h4>Example</h4><pre class="screen">
730 </pre></div></div><div class="refsect2"><a name="idm140001396323264"></a><h3>setifacelink <em class="parameter"><code>IFACE</code></em> up|down</h3><p>
731 Set the internal state of network interface IFACE. This is
732 typically used in the <code class="filename">10.interface</code> script
733 in the "monitor" event.
735 Example: ctdb setifacelink eth0 up
736 </p></div><div class="refsect2"><a name="idm140001396320384"></a><h3>tickle <em class="parameter"><code>SRC-IPADDR</code></em>:<em class="parameter"><code>SRC-PORT</code></em> <em class="parameter"><code>DST-IPADDR</code></em>:<em class="parameter"><code>DST-PORT</code></em></h3><p>
737 Send a TCP tickle to the source host for the specified TCP
738 connection. A TCP tickle is a TCP ACK packet with an invalid
739 sequence and acknowledge number and will when received by the
740 source host result in it sending an immediate correct ACK back
743 TCP tickles are useful to "tickle" clients after a IP failover has
744 occured since this will make the client immediately recognize the
745 TCP connection has been disrupted and that the client will need
746 to reestablish. This greatly speeds up the time it takes for a client
747 to detect and reestablish after an IP failover in the ctdb cluster.
748 </p></div><div class="refsect2"><a name="idm140001396315824"></a><h3>version</h3><p>
749 Display the CTDB version.
750 </p></div></div><div class="refsect1"><a name="idm140001396314544"></a><h2>DEBUGGING COMMANDS</h2><p>
751 These commands are primarily used for CTDB development and testing and
752 should not be used for normal administration.
753 </p><div class="refsect2"><a name="idm140001396313376"></a><h3>OPTIONS</h3><div class="variablelist"><dl class="variablelist"><dt><span class="term">--print-emptyrecords</span></dt><dd><p>
754 This enables printing of empty records when dumping databases
755 with the catdb, cattbd and dumpdbbackup commands. Records with
756 empty data segment are considered deleted by ctdb and cleaned
757 by the vacuuming mechanism, so this switch can come in handy for
758 debugging the vacuuming behaviour.
759 </p></dd><dt><span class="term">--print-datasize</span></dt><dd><p>
760 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
761 size of the record data instead of dumping the data contents.
762 </p></dd><dt><span class="term">--print-lmaster</span></dt><dd><p>
763 This lets catdb print the lmaster for each record.
764 </p></dd><dt><span class="term">--print-hash</span></dt><dd><p>
765 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
766 hash for each record.
767 </p></dd><dt><span class="term">--print-recordflags</span></dt><dd><p>
768 This lets catdb and dumpdbbackup print the
769 record flags for each record. Note that cattdb always
771 </p></dd></dl></div></div><div class="refsect2"><a name="idm140001396304352"></a><h3>process-exists <em class="parameter"><code>PID</code></em></h3><p>
772 This command checks if a specific process exists on the CTDB host. This is mainly used by Samba to check if remote instances of samba are still running or not.
773 </p></div><div class="refsect2"><a name="idm140001396302512"></a><h3>getdbstatus <em class="parameter"><code>DB</code></em></h3><p>
774 This command displays more details about a database.
775 </p><div class="refsect3"><a name="idm140001396300912"></a><h4>Example</h4><pre class="screen">
776 # ctdb getdbstatus test.tdb.0
779 path: /usr/local/var/lib/ctdb/test.tdb.0
783 # ctdb getdbstatus registry.tdb # with a corrupted TDB
786 path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
788 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
789 </pre></div></div><div class="refsect2"><a name="idm140001396298944"></a><h3>catdb <em class="parameter"><code>DB</code></em></h3><p>
790 Print a dump of the clustered TDB database DB.
791 </p></div><div class="refsect2"><a name="idm140001396297296"></a><h3>cattdb <em class="parameter"><code>DB</code></em></h3><p>
792 Print a dump of the contents of the local TDB database DB.
793 </p></div><div class="refsect2"><a name="idm140001396295568"></a><h3>dumpdbbackup <em class="parameter"><code>FILE</code></em></h3><p>
794 Print a dump of the contents from database backup FILE,
795 similar to <span class="command"><strong>catdb</strong></span>.
796 </p></div><div class="refsect2"><a name="idm140001396293216"></a><h3>wipedb <em class="parameter"><code>DB</code></em></h3><p>
797 Remove all contents of database DB.
798 </p></div><div class="refsect2"><a name="idm140001396291568"></a><h3>recover</h3><p>
799 This command will trigger the recovery daemon to do a cluster
801 </p></div><div class="refsect2"><a name="idm140001396290320"></a><h3>ipreallocate, sync</h3><p>
802 This command will force the recovery master to perform a full ip reallocation process and redistribute all ip addresses. This is useful to "reset" the allocations back to its default state if they have been changed using the "moveip" command. While a "recover" will also perform this reallocation, a recovery is much more hevyweight since it will also rebuild all the databases.
803 </p></div><div class="refsect2"><a name="idm140001396288768"></a><h3>getmonmode</h3><p>
804 This command returns the monutoring mode of a node. The monitoring mode is either ACTIVE or DISABLED. Normally a node will continuously monitor that all other nodes that are expected are in fact connected and that they respond to commands.
806 ACTIVE - This is the normal mode. The node is actively monitoring all other nodes, both that the transport is connected and also that the node responds to commands. If a node becomes unavailable, it will be marked as DISCONNECTED and a recovery is initiated to restore the cluster.
808 DISABLED - This node is not monitoring that other nodes are available. In this mode a node failure will not be detected and no recovery will be performed. This mode is useful when for debugging purposes one wants to attach GDB to a ctdb process but wants to prevent the rest of the cluster from marking this node as DISCONNECTED and do a recovery.
809 </p></div><div class="refsect2"><a name="idm140001396285904"></a><h3>setmonmode 0|1</h3><p>
810 This command can be used to explicitly disable/enable monitoring mode on a node. The main purpose is if one wants to attach GDB to a running ctdb daemon but wants to prevent the other nodes from marking it as DISCONNECTED and issuing a recovery. To do this, set monitoring mode to 0 on all nodes before attaching with GDB. Remember to set monitoring mode back to 1 afterwards.
811 </p></div><div class="refsect2"><a name="idm140001396284352"></a><h3>attach <em class="parameter"><code>DBNAME</code></em> [persistent]</h3><p>
812 Create a new CTDB database called DBNAME and attach to it on
814 </p></div><div class="refsect2"><a name="idm140001396282480"></a><h3>detach <em class="parameter"><code>DB-LIST</code></em></h3><p>
815 Detach specified non-persistent database(s) from the cluster. This
816 command will disconnect specified database(s) on all nodes in
817 the cluster. This command should only be used when none of the
818 specified database(s) are in use.
820 All nodes should be active and tunable AllowClientDBAccess should
821 be disabled on all nodes before detaching databases.
822 </p></div><div class="refsect2"><a name="idm140001396280048"></a><h3>dumpmemory</h3><p>
823 This is a debugging command. This command will make the ctdb
824 daemon to write a fill memory allocation map to standard output.
825 </p></div><div class="refsect2"><a name="idm140001396278752"></a><h3>rddumpmemory</h3><p>
826 This is a debugging command. This command will dump the talloc memory
827 allocation tree for the recovery daemon to standard output.
828 </p></div><div class="refsect2"><a name="idm140001396277440"></a><h3>thaw</h3><p>
829 Thaw a previously frozen node.
830 </p></div><div class="refsect2"><a name="idm140001396276288"></a><h3>eventscript <em class="parameter"><code>ARGUMENTS</code></em></h3><p>
831 This is a debugging command. This command can be used to manually
832 invoke and run the eventscritps with arbitrary arguments.
833 </p></div><div class="refsect2"><a name="idm140001396274496"></a><h3>ban <em class="parameter"><code>BANTIME</code></em></h3><p>
834 Administratively ban a node for BANTIME seconds. The node
835 will be unbanned after BANTIME seconds have elapsed.
837 A banned node does not participate in the cluster. It does
838 not host any records for the clustered TDB and does not host
839 any public IP addresses.
841 Nodes are automatically banned if they misbehave. For
842 example, a node may be banned if it causes too many cluster
845 To administratively exclude a node from a cluster use the
846 <span class="command"><strong>stop</strong></span> command.
847 </p></div><div class="refsect2"><a name="idm140001396270512"></a><h3>unban</h3><p>
848 This command is used to unban a node that has either been
849 administratively banned using the ban command or has been
850 automatically banned.
851 </p></div><div class="refsect2"><a name="idm140001396269200"></a><h3>
853 [<span class="optional"><em class="parameter"><code>PNN-LIST</code></em></span>]
855 This command marks the given nodes as rebalance targets in the
856 LCP2 IP allocation algorithm. The
857 <span class="command"><strong>reloadips</strong></span> command will do this as necessary
858 so this command should not be needed.
859 </p></div><div class="refsect2"><a name="idm140001396266464"></a><h3>check_srvids <em class="parameter"><code>SRVID</code></em> ...</h3><p>
860 This command checks whether a set of srvid message ports are
861 registered on the node or not. The command takes a list of
863 </p><div class="refsect3"><a name="idm140001396264656"></a><h4>Example</h4><pre class="screen">
864 # ctdb check_srvids 1 2 3 14765
865 Server id 0:1 does not exist
866 Server id 0:2 does not exist
867 Server id 0:3 does not exist
868 Server id 0:14765 exists
869 </pre></div></div></div><div class="refsect1"><a name="idm140001396262720"></a><h2>SEE ALSO</h2><p>
870 <span class="citerefentry"><span class="refentrytitle">ctdbd</span>(1)</span>,
872 <span class="citerefentry"><span class="refentrytitle">onnode</span>(1)</span>,
874 <span class="citerefentry"><span class="refentrytitle">ctdb</span>(7)</span>,
876 <span class="citerefentry"><span class="refentrytitle">ctdb-statistics</span>(7)</span>,
878 <span class="citerefentry"><span class="refentrytitle">ctdb-tunables</span>(7)</span>,
880 <a class="ulink" href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
881 </p></div></div></body></html>