python:tests: Replace deprecated method assertRaisesRegexp()
[Samba.git] / ctdb / doc / ctdb.1.xml
blobe97da35489a51a3991a2a84739b017cb08009fd4
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE refentry
3         PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4         "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
5 <refentry id="ctdb.1">
7   <refentryinfo>
8     <author>
9       <contrib>
10         This documentation was written by
11         Ronnie Sahlberg,
12         Amitay Isaacs,
13         Martin Schwenke
14       </contrib>
15     </author>
17     <copyright>
18       <year>2007</year>
19       <holder>Andrew Tridgell</holder>
20       <holder>Ronnie Sahlberg</holder>
21     </copyright>
22     <legalnotice>
23       <para>
24         This program is free software; you can redistribute it and/or
25         modify it under the terms of the GNU General Public License as
26         published by the Free Software Foundation; either version 3 of
27         the License, or (at your option) any later version.
28       </para>
29       <para>
30         This program is distributed in the hope that it will be
31         useful, but WITHOUT ANY WARRANTY; without even the implied
32         warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
33         PURPOSE.  See the GNU General Public License for more details.
34       </para>
35       <para>
36         You should have received a copy of the GNU General Public
37         License along with this program; if not, see
38         <ulink url="http://www.gnu.org/licenses"/>.
39       </para>
40     </legalnotice>
41   </refentryinfo>
43   <refmeta>
44     <refentrytitle>ctdb</refentrytitle>
45     <manvolnum>1</manvolnum>
46     <refmiscinfo class="source">ctdb</refmiscinfo>
47     <refmiscinfo class="manual">CTDB - clustered TDB database</refmiscinfo>
48   </refmeta>
50   <refnamediv>
51     <refname>ctdb</refname>
52     <refpurpose>CTDB management utility</refpurpose>
53   </refnamediv>
55   <refsynopsisdiv>
56     <cmdsynopsis>
57       <command>ctdb</command>
58       <arg rep="repeat"><replaceable>OPTION</replaceable></arg>
59       <arg choice="req"><replaceable>COMMAND</replaceable></arg>
60       <arg choice="opt"><replaceable>COMMAND-ARGS</replaceable></arg>
61     </cmdsynopsis>
62   </refsynopsisdiv>
64   <refsect1>
65     <title>DESCRIPTION</title>
66     <para>
67       ctdb is a utility to view and manage a CTDB cluster.
68     </para>
70     <para>
71       The following terms are used when referring to nodes in a
72       cluster:
73       <variablelist>
74         <varlistentry>
75           <term>PNN</term>
76           <listitem>
77             <para>
78               Physical Node Number.  The physical node number is an
79               integer that describes the node in the cluster. The
80               first node has physical node number 0.  in a cluster.
81             </para>
82           </listitem>
83         </varlistentry>
84         <varlistentry>
85           <term>PNN-LIST</term>
86           <listitem>
87             <para>
88               This is either a single PNN, a comma-separate list of PNNs
89               or "all".
90             </para>
91           </listitem>
92         </varlistentry>
93       </variablelist>
94     </para>
96     <para>
97       Commands that reference a database use the following terms:
98       <variablelist>
99         <varlistentry>
100           <term>DB</term>
101           <listitem>
102             <para>
103               This is either a database name, such as
104               <filename>locking.tdb</filename> or a database ID such
105               as "0x42fe72c5".
106             </para>
107           </listitem>
108         </varlistentry>
109         <varlistentry>
110           <term>DB-LIST</term>
111           <listitem>
112             <para>
113               A space separated list of at least one
114               <parameter>DB</parameter>.
115             </para>
116           </listitem>
117         </varlistentry>
118       </variablelist>
119     </para>
120   </refsect1>
122   <refsect1>
123     <title>OPTIONS</title>
125     <variablelist>
126       <varlistentry><term>-n <parameter>PNN</parameter></term>
127       <listitem>
128         <para>
129           The node specified by PNN should be queried for the
130           requested information.  Default is to query the daemon
131           running on the local host.
132         </para>
133       </listitem>
134       </varlistentry>
136       <varlistentry><term>-Y</term>
137       <listitem>
138         <para>
139           Produce output in machine readable form for easier parsing
140           by scripts. This uses a field delimiter of ':'.  Not all
141           commands support this option.
142         </para>
143       </listitem>
144       </varlistentry>
146       <varlistentry><term>-x <parameter>SEPARATOR</parameter></term>
147       <listitem>
148         <para>
149           Use SEPARATOR to delimit fields in machine readable output.
150           This implies -Y.
151         </para>
152       </listitem>
153       </varlistentry>
155       <varlistentry><term>-X</term>
156       <listitem>
157         <para>
158           Produce output in machine readable form for easier parsing
159           by scripts. This uses a field delimiter of '|'.  Not all
160           commands support this option.
161         </para>
162         <para>
163           This is equivalent to "-x|" and avoids some shell quoting
164           issues.
165         </para>
166       </listitem>
167       </varlistentry>
169       <varlistentry><term>-t <parameter>TIMEOUT</parameter></term>
170       <listitem>
171         <para>
172           Indicates that ctdb should wait up to TIMEOUT seconds for
173           a response to most commands sent to the CTDB daemon.  The
174           default is 10 seconds.
175         </para>
176       </listitem>
177       </varlistentry>
179       <varlistentry><term>-T <parameter>TIMELIMIT</parameter></term>
180       <listitem>
181         <para>
182           Indicates that TIMELIMIT is the maximum run time (in
183           seconds) for the ctdb command.  When TIMELIMIT is exceeded
184           the ctdb command will terminate with an error.  The default
185           is 120 seconds.
186         </para>
187       </listitem>
188       </varlistentry>
190       <varlistentry><term>-? --help</term>
191       <listitem>
192         <para>
193           Print some help text to the screen.
194         </para>
195       </listitem>
196       </varlistentry>
198       <varlistentry><term>--usage</term>
199       <listitem>
200         <para>
201           Print usage information to the screen.
202         </para>
203       </listitem>
204       </varlistentry>
206       <varlistentry><term>-d --debug=<parameter>DEBUGLEVEL</parameter></term>
207       <listitem>
208         <para>
209           Change the debug level for the command. Default is NOTICE.
210         </para>
211       </listitem>
212       </varlistentry>
213     </variablelist>
214   </refsect1>
217   <refsect1>
218     <title>ADMINISTRATIVE COMMANDS</title>
219     <para>
220       These are commands used to monitor and administer a CTDB cluster.
221     </para>
223     <refsect2>
224       <title>pnn</title>
225       <para>
226         This command displays the PNN of the current node.
227       </para>
228     </refsect2>
230     <refsect2>
231       <title>status</title>
232       <para>
233         This command shows the current status of all CTDB nodes based
234         on information from the queried node.
235       </para>
237       <para>
238         Note: If the queried node is INACTIVE then the status
239         might not be current.
240       </para>
242       <refsect3>
243         <title>Node status</title>
244         <para>
245           This includes the number of physical nodes and the status of
246           each node.  See <citerefentry><refentrytitle>ctdb</refentrytitle>
247           <manvolnum>7</manvolnum></citerefentry> for information
248           about node states.
249         </para>
250       </refsect3>
252       <refsect3>
253         <title>Generation</title>
254         <para>
255           The generation id is a number that indicates the current generation
256           of a cluster instance. Each time a cluster goes through a
257           reconfiguration or a recovery its generation id will be changed.
258         </para>
259         <para>
260           This number does not have any particular meaning other than
261           to keep track of when a cluster has gone through a
262           recovery. It is a random number that represents the current
263           instance of a ctdb cluster and its databases.  The CTDB
264           daemon uses this number internally to be able to tell when
265           commands to operate on the cluster and the databases was
266           issued in a different generation of the cluster, to ensure
267           that commands that operate on the databases will not survive
268           across a cluster database recovery.  After a recovery, all
269           old outstanding commands will automatically become invalid.
270         </para>
271         <para>
272           Sometimes this number will be shown as "INVALID". This only means that
273           the ctdbd daemon has started but it has not yet merged with the cluster through a recovery.
274           All nodes start with generation "INVALID" and are not assigned a real
275           generation id until they have successfully been merged with a cluster
276           through a recovery.
277         </para>
278       </refsect3>
280       <refsect3>
281         <title>Virtual Node Number (VNN) map</title>
282         <para>
283           Consists of the number of virtual nodes and mapping from
284           virtual node numbers to physical node numbers.  Only nodes
285           that are participating in the VNN map can become lmaster for
286           database records.
287         </para>
288       </refsect3>
290       <refsect3>
291         <title>Recovery mode</title>
292         <para>
293           This is the current recovery mode of the cluster. There are two possible modes:
294         </para>
295         <para>
296           NORMAL - The cluster is fully operational.
297         </para>
298         <para>
299           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.
300         </para>
301         <para>
302           Once the leader detects an inconsistency, for example a node
303           becomes disconnected/connected, the recovery daemon will trigger a
304           cluster recovery process, where all databases are remerged across the
305           cluster. When this process starts, the leader will first
306           "freeze" all databases to prevent applications such as samba from
307           accessing the databases and it will also mark the recovery mode as
308           RECOVERY.
309         </para>
310         <para>
311           When the CTDB daemon starts up, it will start in RECOVERY
312           mode.  Once the node has been merged into a cluster and all
313           databases have been recovered, the node mode will change into
314           NORMAL mode and the databases will be "thawed", allowing samba
315           to access the databases again.
316         </para>
317       </refsect3>
318       <refsect3>
319         <title>Leader</title>
320         <para>
321           This is the cluster node that is currently designated as the
322           leader. This node is responsible of monitoring the
323           consistency of the cluster and to perform the actual
324           recovery process when required.
325         </para>
326         <para>
327           Only one node at a time can be the designated leader. Which
328           node is designated the leader is decided by an election
329           process in the recovery daemons running on each node.
330         </para>
331       </refsect3>
333       <refsect3>
334         <title>Example</title>
335         <screen>
336 # ctdb status
337 Number of nodes:4
338 pnn:0 192.168.2.200       OK (THIS NODE)
339 pnn:1 192.168.2.201       OK
340 pnn:2 192.168.2.202       OK
341 pnn:3 192.168.2.203       OK
342 Generation:1362079228
343 Size:4
344 hash:0 lmaster:0
345 hash:1 lmaster:1
346 hash:2 lmaster:2
347 hash:3 lmaster:3
348 Recovery mode:NORMAL (0)
349 Leader:0
350         </screen>
351       </refsect3>
352     </refsect2>
354     <refsect2>
355       <title>nodestatus <optional><parameter>PNN-LIST</parameter></optional></title>
356       <para>
357         This command is similar to the <command>status</command>
358         command.  It displays the "node status" subset of output.  The
359         main differences are:
360       </para>
362       <itemizedlist>
363         <listitem>
364           <para>
365             The exit code is the bitwise-OR of the flags for each
366             specified node, while <command>ctdb status</command> exits
367             with 0 if it was able to retrieve status for all nodes.
368           </para>
369         </listitem>
371         <listitem>
372           <para>
373             <command>ctdb status</command> provides status information
374             for all nodes.  <command>ctdb nodestatus</command>
375             defaults to providing status for only the current node.
376             If PNN-LIST is provided then status is given for
377             the indicated node(s).
378           </para>
379         </listitem>
380       </itemizedlist>
382       <para>
383         A common invocation in scripts is <command>ctdb nodestatus
384         all</command> to check whether all nodes in a cluster are
385         healthy.
386       </para>
388       <refsect3>
389         <title>Example</title>
390         <screen>
391 # ctdb nodestatus
392 pnn:0 10.0.0.30        OK (THIS NODE)
394 # ctdb nodestatus all
395 Number of nodes:2
396 pnn:0 10.0.0.30        OK (THIS NODE)
397 pnn:1 10.0.0.31        OK
398         </screen>
399       </refsect3>
400     </refsect2>
402     <refsect2>
403       <title>leader</title>
404       <para>
405         This command shows the pnn of the node which is currently the leader.
406       </para>
408       <para>
409         Note: If the queried node is INACTIVE then the status
410         might not be current.
411       </para>
412     </refsect2>
414     <refsect2>
415       <title>uptime</title>
416       <para>
417         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.
418       </para>
420       <refsect3>
421         <title>Example</title>
422         <screen>
423 # ctdb uptime
424 Current time of node          :                Thu Oct 29 10:38:54 2009
425 Ctdbd start time              : (000 16:54:28) Wed Oct 28 17:44:26 2009
426 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
427 Duration of last recovery/failover: 2.248552 seconds
428         </screen>
429       </refsect3>
430     </refsect2>
432     <refsect2>
433       <title>listnodes</title>
434       <para>
435         This command shows lists the ip addresses of all the nodes in the cluster.
436       </para>
438       <refsect3>
439         <title>Example</title>
440         <screen>
441 # ctdb listnodes
442 192.168.2.200
443 192.168.2.201
444 192.168.2.202
445 192.168.2.203
446         </screen>
447       </refsect3>
448     </refsect2>
450     <refsect2>
451       <title>natgw {leader|list|status}</title>
452       <para>
453         This command shows different aspects of NAT gateway status.
454         For an overview of CTDB's NAT gateway functionality please see
455         the <citetitle>NAT GATEWAY</citetitle> section in
456         <citerefentry><refentrytitle>ctdb</refentrytitle>
457         <manvolnum>7</manvolnum></citerefentry>.
458       </para>
460       <variablelist>
461         <varlistentry>
462           <term>leader</term>
463           <listitem>
464             <para>
465               Show the PNN and private IP address of the current NAT
466               gateway leader node.
467             </para>
468             <para>
469               Example output:
470             </para>
471             <screen>
472 1 192.168.2.201
473             </screen>
474           </listitem>
475         </varlistentry>
476         <varlistentry>
477           <term>list</term>
478           <listitem>
479             <para>
480               List the private IP addresses of nodes in the current
481               NAT gateway group, annotating the leader node.
482             </para>
483             <para>
484               Example output:
485             </para>
486             <screen>
487 192.168.2.200
488 192.168.2.201   LEADER
489 192.168.2.202
490 192.168.2.203
491             </screen>
492           </listitem>
493         </varlistentry>
494         <varlistentry>
495           <term>status</term>
496           <listitem>
497             <para>
498               List the nodes in the current NAT gateway group and
499               their status.
500             </para>
501             <para>
502               Example output:
503             </para>
504             <screen>
505 pnn:0 192.168.2.200       UNHEALTHY (THIS NODE)
506 pnn:1 192.168.2.201       OK
507 pnn:2 192.168.2.202       OK
508 pnn:3 192.168.2.203       OK
509             </screen>
510           </listitem>
511         </varlistentry>
512       </variablelist>
513     </refsect2>
515     <refsect2>
516       <title>ping</title>
517       <para>
518         This command will "ping" specified CTDB nodes in the cluster
519         to verify that they are running.
520       </para>
521       <refsect3>
522         <title>Example</title>
523         <screen>
524 # ctdb ping
525 response from 0 time=0.000054 sec  (3 clients)
526         </screen>
527       </refsect3>
528     </refsect2>
530     <refsect2>
531       <title>ifaces</title>
532       <para>
533         This command will display the list of network interfaces, which could
534         host public addresses, along with their status.
535       </para>
536       <refsect3>
537         <title>Example</title>
538         <screen>
539 # ctdb ifaces
540 Interfaces on node 0
541 name:eth5 link:up references:2
542 name:eth4 link:down references:0
543 name:eth3 link:up references:1
544 name:eth2 link:up references:1
546 # ctdb -X ifaces
547 |Name|LinkStatus|References|
548 |eth5|1|2|
549 |eth4|0|0|
550 |eth3|1|1|
551 |eth2|1|1|
552         </screen>
553       </refsect3>
554     </refsect2>
556     <refsect2>
557       <title>ip</title>
558       <para>
559         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".
560       </para>
561       <refsect3>
562         <title>Example</title>
563         <screen>
564 # ctdb ip -v
565 Public IPs on node 0
566 172.31.91.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
567 172.31.91.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
568 172.31.91.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
569 172.31.91.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
570 172.31.92.82 node[1] active[] available[eth5] configured[eth4,eth5]
571 172.31.92.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
572 172.31.92.84 node[1] active[] available[eth5] configured[eth4,eth5]
573 172.31.92.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
575 # ctdb -X ip -v
576 |Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|
577 |172.31.91.82|1||eth2,eth3|eth2,eth3|
578 |172.31.91.83|0|eth3|eth2,eth3|eth2,eth3|
579 |172.31.91.84|1||eth2,eth3|eth2,eth3|
580 |172.31.91.85|0|eth2|eth2,eth3|eth2,eth3|
581 |172.31.92.82|1||eth5|eth4,eth5|
582 |172.31.92.83|0|eth5|eth5|eth4,eth5|
583 |172.31.92.84|1||eth5|eth4,eth5|
584 |172.31.92.85|0|eth5|eth5|eth4,eth5|
585         </screen>
586       </refsect3>
587     </refsect2>
589     <refsect2>
590       <title>ipinfo <parameter>IP</parameter></title>
591       <para>
592         This command will display details about the specified public addresses.
593       </para>
594       <refsect3>
595         <title>Example</title>
596         <screen>
597 # ctdb ipinfo 172.31.92.85
598 Public IP[172.31.92.85] info on node 0
599 IP:172.31.92.85
600 CurrentNode:0
601 NumInterfaces:2
602 Interface[1]: Name:eth4 Link:down References:0
603 Interface[2]: Name:eth5 Link:up References:2 (active)
604         </screen>
605       </refsect3>
606     </refsect2>
608     <refsect2>
609       <title>event run|status|script list|script enable|script disable</title>
610       <para>
611         This command is used to control event daemon and to inspect
612         status of various events.
613       </para>
615       <para>
616         The commands below require a component to be specified.  In
617         the current version the only valid component is
618         <literal>legacy</literal>.
619       </para>
621       <variablelist>
622         <varlistentry>
623           <term>run <parameter>TIMEOUT</parameter> <parameter>COMPONENT</parameter> <parameter>EVENT</parameter> <optional><parameter>ARGUMENTS</parameter></optional> </term>
624           <listitem>
625             <para>
626              This command can be used to manually run specified EVENT
627              in COMPONENT with optional ARGUMENTS.  The event will be
628              allowed to run a maximum of TIMEOUT seconds.  If TIMEOUT
629              is 0, then there is no time limit for running the event.
630             </para>
631           </listitem>
632         </varlistentry>
634         <varlistentry>
635           <term>status <parameter>COMPONENT</parameter> <parameter>EVENT</parameter></term>
636           <listitem>
637             <para>
638               This command displays the last execution status of the
639               specified EVENT in COMPONENT.
640             </para>
641             <para>
642               The command will terminate with the exit status
643               corresponding to the overall status of event that is
644               displayed.
645             </para>
646             <para>
647               The output is the list of event scripts executed.
648               Each line shows the name, status, duration and start time
649               for each script.  Output from each script is shown.
650             </para>
651             <para>
652               Example #1
653             </para>
654             <screen>
655 # ctdb event status legacy monitor
656 00.ctdb              OK         0.014 Sat Dec 17 19:39:11 2016
657 01.reclock           OK         0.013 Sat Dec 17 19:39:11 2016
658 05.system            OK         0.029 Sat Dec 17 19:39:11 2016
659 10.interface         OK         0.037 Sat Dec 17 19:39:11 2016
660 11.natgw             OK         0.011 Sat Dec 17 19:39:11 2016
661 11.routing           OK         0.007 Sat Dec 17 19:39:11 2016
662 13.per_ip_routing    OK         0.007 Sat Dec 17 19:39:11 2016
663 20.multipathd        OK         0.007 Sat Dec 17 19:39:11 2016
664 31.clamd             OK         0.007 Sat Dec 17 19:39:11 2016
665 40.vsftpd            OK         0.013 Sat Dec 17 19:39:11 2016
666 41.httpd             OK         0.018 Sat Dec 17 19:39:11 2016
667 49.winbind           OK         0.023 Sat Dec 17 19:39:11 2016
668 50.samba             OK         0.100 Sat Dec 17 19:39:12 2016
669 60.nfs               OK         0.376 Sat Dec 17 19:39:12 2016
670 70.iscsi             OK         0.009 Sat Dec 17 19:39:12 2016
671 91.lvs               OK         0.007 Sat Dec 17 19:39:12 2016
672             </screen>
674             <para>
675               Example #2
676             </para>
677             <screen>
678 # ctdb event status legacy monitor
679 00.ctdb              OK         0.011 Sat Dec 17 19:40:46 2016
680 01.reclock           OK         0.010 Sat Dec 17 19:40:46 2016
681 05.system            OK         0.030 Sat Dec 17 19:40:46 2016
682 10.interface         OK         0.041 Sat Dec 17 19:40:46 2016
683 11.natgw             OK         0.008 Sat Dec 17 19:40:46 2016
684 11.routing           OK         0.007 Sat Dec 17 19:40:46 2016
685 13.per_ip_routing    OK         0.007 Sat Dec 17 19:40:46 2016
686 20.multipathd        OK         0.007 Sat Dec 17 19:40:46 2016
687 31.clamd             OK         0.007 Sat Dec 17 19:40:46 2016
688 40.vsftpd            OK         0.013 Sat Dec 17 19:40:46 2016
689 41.httpd             OK         0.015 Sat Dec 17 19:40:46 2016
690 49.winbind           OK         0.022 Sat Dec 17 19:40:46 2016
691 50.samba             ERROR      0.077 Sat Dec 17 19:40:46 2016
692   OUTPUT: ERROR: samba tcp port 445 is not responding
693             </screen>
694           </listitem>
695         </varlistentry>
697         <varlistentry>
698           <term>script list <parameter>COMPONENT</parameter></term>
699           <listitem>
700             <para>
701               List the available event scripts in COMPONENT.  Enabled
702               scripts are flagged with a '*'.
703             </para>
704             <para>
705               Generally, event scripts are provided by CTDB.  However,
706               local or 3rd party event scripts may also be available.
707               These are shown in a separate section after those
708               provided by CTDB.
709             </para>
710             <para>
711               Example
712             </para>
713             <screen>
714 # ctdb event script list legacy
715 * 00.ctdb             
716 * 01.reclock          
717 * 05.system           
718 * 10.interface        
719   11.natgw            
720   11.routing          
721   13.per_ip_routing   
722   20.multipathd       
723   31.clamd            
724   40.vsftpd           
725   41.httpd            
726 * 49.winbind          
727 * 50.samba            
728 * 60.nfs              
729   70.iscsi            
730   91.lvs              
732 * 02.local            
733             </screen>
734           </listitem>
735         </varlistentry>
737         <varlistentry>
738           <term>script enable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
739           <listitem>
740             <para>
741               Enable the specified event SCRIPT in COMPONENT.  Only
742               enabled scripts will be executed when running any event.
743             </para>
744           </listitem>
745         </varlistentry>
747         <varlistentry>
748           <term>script disable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
749           <listitem>
750             <para>
751               Disable the specified event SCRIPT in COMPONENT.  This
752               will prevent the script from executing when running any
753               event.
754             </para>
755           </listitem>
756         </varlistentry>
757       </variablelist>
758     </refsect2>
760     <refsect2>
761       <title>scriptstatus</title>
762       <para>
763         This is an alias for <command>ctdb event status legacy
764         <optional>EVENT</optional></command>, where EVENT defaults to
765         <command>monitor</command>.
766       </para>
767       <para>
768         This command is deprecated.  It's provided for backward
769         compatibility.  Use <command>ctdb event status</command>
770         instead.
771       </para>
772     </refsect2>
774     <refsect2>
775       <title>listvars</title>
776       <para>
777         List all tuneable variables, except the values of the obsolete tunables
778         like VacuumMinInterval. The obsolete tunables can be retrieved only
779         explicitly with the "ctdb getvar" command.
780       </para>
781       <refsect3>
782         <title>Example</title>
783         <screen>
784 # ctdb listvars
785 SeqnumInterval          = 1000
786 ControlTimeout          = 60
787 TraverseTimeout         = 20
788 KeepaliveInterval       = 5
789 KeepaliveLimit          = 5
790 RecoverTimeout          = 120
791 RecoverInterval         = 1
792 ElectionTimeout         = 3
793 TakeoverTimeout         = 9
794 MonitorInterval         = 15
795 TickleUpdateInterval    = 20
796 EventScriptTimeout      = 30
797 MonitorTimeoutCount     = 20
798 RecoveryGracePeriod     = 120
799 RecoveryBanPeriod       = 300
800 DatabaseHashSize        = 100001
801 DatabaseMaxDead         = 5
802 RerecoveryTimeout       = 10
803 EnableBans              = 1
804 NoIPFailback            = 0
805 VerboseMemoryNames      = 0
806 RecdPingTimeout         = 60
807 RecdFailCount           = 10
808 LogLatencyMs            = 0
809 RecLockLatencyMs        = 1000
810 RecoveryDropAllIPs      = 120
811 VacuumInterval          = 10
812 VacuumMaxRunTime        = 120
813 RepackLimit             = 10000
814 VacuumFastPathCount     = 60
815 MaxQueueDropMsg         = 1000000
816 AllowUnhealthyDBRead    = 0
817 StatHistoryInterval     = 1
818 DeferredAttachTO        = 120
819 AllowClientDBAttach     = 1
820 RecoverPDBBySeqNum      = 1
821 DeferredRebalanceOnNodeAdd = 300
822 FetchCollapse           = 1
823 HopcountMakeSticky      = 50
824 StickyDuration          = 600
825 StickyPindown           = 200
826 NoIPTakeover            = 0
827 DBRecordCountWarn       = 100000
828 DBRecordSizeWarn        = 10000000
829 DBSizeWarn              = 100000000
830 PullDBPreallocation     = 10485760
831 LockProcessesPerDB      = 200
832 RecBufferSizeLimit      = 1000000
833 QueueBufferSize         = 1024
834 IPAllocAlgorithm        = 2
835         </screen>
836       </refsect3>
837     </refsect2>
839     <refsect2>
840       <title>getvar <parameter>NAME</parameter></title>
841       <para>
842         Get the runtime value of a tuneable variable.
843       </para>
844       <refsect3>
845         <title>Example</title>
846         <screen>
847 # ctdb getvar MonitorInterval
848 MonitorInterval         = 15
849         </screen>
850       </refsect3>
851     </refsect2>
853     <refsect2>
854       <title>setvar <parameter>NAME</parameter> <parameter>VALUE</parameter></title>
855       <para>
856         Set the runtime value of a tuneable variable.
857       </para>
858       <refsect3>
859         <title>Example</title>
860         <screen>
861 # ctdb setvar MonitorInterval 20
862         </screen>
863       </refsect3>
864     </refsect2>
866     <refsect2>
867       <title>lvs {leader|list|status}</title>
868       <para>
869         This command shows different aspects of LVS status.  For an
870         overview of CTDB's LVS functionality please see the
871         <citetitle>LVS</citetitle> section in
872         <citerefentry><refentrytitle>ctdb</refentrytitle>
873         <manvolnum>7</manvolnum></citerefentry>.
874       </para>
876       <variablelist>
877         <varlistentry>
878           <term>leader</term>
879           <listitem>
880             <para>
881               Shows the PNN of the current LVS leader node.
882             </para>
883       <para>
884         Example output:
885       </para>
886       <screen>
888       </screen>
889           </listitem>
890         </varlistentry>
891         <varlistentry>
892           <term>list</term>
893           <listitem>
894             <para>
895               Lists the currently usable LVS nodes.
896             </para>
897       <para>
898         Example output:
899       </para>
900       <screen>
901 2 10.0.0.13
902 3 10.0.0.14
903       </screen>
904           </listitem>
905         </varlistentry>
906         <varlistentry>
907           <term>status</term>
908           <listitem>
909             <para>
910               List the nodes in the current LVS group and their status.
911             </para>
912       <para>
913         Example output:
914       </para>
915       <screen>
916 pnn:0 10.0.0.11        UNHEALTHY (THIS NODE)
917 pnn:1 10.0.0.12        UNHEALTHY
918 pnn:2 10.0.0.13        OK
919 pnn:3 10.0.0.14        OK
920       </screen>
921           </listitem>
922         </varlistentry>
923       </variablelist>
925     </refsect2>
928     <refsect2>
929       <title>getcapabilities</title>
931       <para>
932         This command shows the capabilities of the current node.  See
933         the <citetitle>CAPABILITIES</citetitle> section in
934         <citerefentry><refentrytitle>ctdb</refentrytitle>
935         <manvolnum>7</manvolnum></citerefentry> for more details.
936       </para>
938       <para>
939         Example output:
940       </para>
941       <screen>
942 LEADER: YES
943 LMASTER: YES
944       </screen>
946     </refsect2>
948     <refsect2>
949       <title>statistics</title>
950       <para>
951         Collect statistics from the CTDB daemon about
952         how many calls it has served.  Information about
953         various fields in statistics can be found in
954         <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
955         <manvolnum>7</manvolnum></citerefentry>.
956       </para>
957       <refsect3>
958         <title>Example</title>
959         <screen>
960 # ctdb statistics
961 CTDB version 1
962 Current time of statistics  :                Tue Mar  8 15:18:51 2016
963 Statistics collected since  : (003 21:31:32) Fri Mar  4 17:47:19 2016
964  num_clients                        9
965  frozen                             0
966  recovering                         0
967  num_recoveries                     2
968  client_packets_sent          8170534
969  client_packets_recv          7166132
970  node_packets_sent           16549998
971  node_packets_recv            5244418
972  keepalive_packets_sent        201969
973  keepalive_packets_recv        201969
974  node
975      req_call                      26
976      reply_call                     0
977      req_dmaster                    9
978      reply_dmaster                 12
979      reply_error                    0
980      req_message              1339231
981      req_control              8177506
982      reply_control            6831284
983  client
984      req_call                      15
985      req_message               334809
986      req_control              6831308
987  timeouts
988      call                           0
989      control                        0
990      traverse                       0
991  locks
992      num_calls                      8
993      num_current                    0
994      num_pending                    0
995      num_failed                     0
996  total_calls                       15
997  pending_calls                      0
998  childwrite_calls                   0
999  pending_childwrite_calls             0
1000  memory_used                   394879
1001  max_hop_count                      1
1002  total_ro_delegations               0
1003  total_ro_revokes                   0
1004  hop_count_buckets: 8 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1005  lock_buckets: 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0
1006  locks_latency      MIN/AVG/MAX     0.010005/0.010418/0.011010 sec out of 8
1007  reclock_ctdbd      MIN/AVG/MAX     0.002538/0.002538/0.002538 sec out of 1
1008  reclock_recd       MIN/AVG/MAX     0.000000/0.000000/0.000000 sec out of 0
1009  call_latency       MIN/AVG/MAX     0.000044/0.002142/0.011702 sec out of 15
1010  childwrite_latency MIN/AVG/MAX     0.000000/0.000000/0.000000 sec out of 0
1011         </screen>
1012       </refsect3>
1013     </refsect2>
1015     <refsect2>
1016       <title>statisticsreset</title>
1017       <para>
1018         This command is used to clear all statistics counters in a node.
1019       </para>
1020       <para>
1021         Example: ctdb statisticsreset
1022       </para>
1023     </refsect2>
1025     <refsect2>
1026       <title>dbstatistics <parameter>DB</parameter></title>
1027       <para>
1028         Display statistics about the database DB.  Information
1029         about various fields in dbstatistics can be found in
1030         <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1031         <manvolnum>7</manvolnum></citerefentry>.
1032       </para>
1033       <refsect3>
1034         <title>Example</title>
1035         <screen>
1036 # ctdb dbstatistics locking.tdb
1037 DB Statistics: locking.tdb
1038  ro_delegations                     0
1039  ro_revokes                         0
1040  locks
1041      total                      14356
1042      failed                         0
1043      current                        0
1044      pending                        0
1045  hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1046  lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
1047  locks_latency      MIN/AVG/MAX     0.001066/0.012686/4.202292 sec out of 14356
1048  vacuum_latency     MIN/AVG/MAX     0.000472/0.002207/15.243570 sec out of 224530
1049  Num Hot Keys:     1
1050      Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
1051         </screen>
1052       </refsect3>
1053     </refsect2>
1055     <refsect2>
1056       <title>getreclock</title>
1057       <para>
1058         Show details of the recovery lock, if any.
1059       </para>
1061       <para>
1062         Example output:
1063       </para>
1064       <screen>
1065         /clusterfs/.ctdb/recovery.lock
1066       </screen>
1068     </refsect2>
1070     <refsect2>
1071       <title>getdebug</title>
1072       <para>
1073         Get the current debug level for the node. the debug level controls what information is written to the log file.
1074       </para>
1075       <para>
1076         The debug levels are mapped to the corresponding syslog levels.
1077         When a debug level is set, only those messages at that level and higher
1078         levels will be printed.
1079       </para>
1080       <para>
1081         The list of debug levels from highest to lowest are :
1082       </para>
1083       <para>
1084         ERROR WARNING NOTICE INFO DEBUG
1085       </para>
1086     </refsect2>
1088     <refsect2>
1089       <title>setdebug <parameter>DEBUGLEVEL</parameter></title>
1090       <para>
1091         Set the debug level of a node. This controls what information will be logged.
1092       </para>
1093       <para>
1094         The debuglevel is one of ERROR WARNING NOTICE INFO DEBUG
1095       </para>
1096     </refsect2>
1098     <refsect2>
1099       <title>getpid</title>
1100       <para>
1101         This command will return the process id of the ctdb daemon.
1102       </para>
1103     </refsect2>
1105     <refsect2>
1106       <title>disable</title>
1107       <para>
1108         This command is used to administratively disable a node in the cluster.
1109         A disabled node will still participate in the cluster and host
1110         clustered TDB records but its public ip address has been taken over by
1111         a different node and it no longer hosts any services.
1112       </para>
1113     </refsect2>
1115     <refsect2>
1116       <title>enable</title>
1117       <para>
1118         Re-enable a node that has been administratively disabled.
1119       </para>
1120     </refsect2>
1122     <refsect2>
1123       <title>stop</title>
1124       <para>
1125         This command is used to administratively STOP a node in the cluster.
1126         A STOPPED node is connected to the cluster but will not host any
1127         public ip addresses, nor does it participate in the VNNMAP.
1128         The difference between a DISABLED node and a STOPPED node is that
1129         a STOPPED node does not host any parts of the database which means
1130         that a recovery is required to stop/continue nodes.
1131       </para>
1132     </refsect2>
1134     <refsect2>
1135       <title>continue</title>
1136       <para>
1137         Re-start a node that has been administratively stopped.
1138       </para>
1139     </refsect2>
1141     <refsect2>
1142       <title>addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter></title>
1143       <para>
1144         This command is used to add a new public ip to a node
1145         during runtime.  It should be followed by a <command>ctdb
1146         ipreallocate</command>.  This allows public addresses to be
1147         added to a cluster without having to restart the ctdb daemons.
1148       </para>
1149       <para>
1150         Note that this only updates the runtime instance of ctdb. Any
1151         changes will be lost next time ctdb is restarted and the public
1152         addresses file is re-read.  If you want this change to be
1153         permanent you must also update the public addresses file manually.
1154       </para>
1155     </refsect2>
1157     <refsect2>
1158       <title>delip <parameter>IPADDR</parameter></title>
1159       <para>
1160         This command flags IPADDR for deletion from a node at runtime.
1161         It should be followed by a <command>ctdb
1162         ipreallocate</command>.  If IPADDR is currently hosted by the
1163         node it is being removed from, this ensures that the IP will
1164         first be failed over to another node, if possible, and that it
1165         is then actually removed.
1166       </para>
1167       <para>
1168         Note that this only updates the runtime instance of CTDB.  Any
1169         changes will be lost next time CTDB is restarted and the
1170         public addresses file is re-read.  If you want this change to
1171         be permanent you must also update the public addresses file
1172         manually.
1173       </para>
1174     </refsect2>
1176     <refsect2>
1177       <title>moveip <parameter>IPADDR</parameter> <parameter>PNN</parameter></title>
1178       <para>
1179         This command can be used to manually fail a public ip address to a
1180         specific node.
1181       </para>
1182       <para>
1183         In order to manually override the "automatic" distribution of public
1184         ip addresses that ctdb normally provides, this command only works
1185         when you have changed the tunables for the daemon to:
1186       </para>
1187       <para>
1188         IPAllocAlgorithm != 0
1189       </para>
1190       <para>
1191         NoIPFailback = 1
1192       </para>
1193     </refsect2>
1195     <refsect2>
1196       <title>shutdown</title>
1197       <para>
1198         This command will shutdown a specific CTDB daemon.
1199       </para>
1200     </refsect2>
1202     <refsect2>
1203       <title>setlmasterrole on|off</title>
1204       <para>
1205         This command is used to 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.
1206       </para>
1208       <para>
1209         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.
1210       </para>
1211       <para>
1212         Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
1213       </para>
1214       <para>
1215         See also "ctdb getcapabilities"
1216       </para>
1217     </refsect2>
1219     <refsect2>
1220       <title>setleaderrole on|off</title>
1221       <para>
1222         This command is used to enable/disable the LEADER capability
1223         for a node at runtime. This capability determines whether or
1224         not a node can be elected leader of the cluster. A node that
1225         does not have the LEADER capability can not be elected
1226         leader. If the current leader has this capability removed then
1227         an election will occur.
1228       </para>
1230       <para>
1231         Nodes have this capability enabled by default, but it can be
1232         removed via the <command>cluster:leader capability</command>
1233         configuration setting or by using this command.
1234       </para>
1235       <para>
1236         See also "ctdb getcapabilities"
1237       </para>
1238     </refsect2>
1240     <refsect2>
1241       <title>reloadnodes</title>
1242       <para>
1243         This command is used when adding new nodes, or removing
1244         existing nodes from an existing cluster.
1245       </para>
1246       <para>
1247         Procedure to add nodes:
1248       </para>
1249       <orderedlist>
1250         <listitem>
1251           <para>
1252              To expand an existing cluster, first ensure with
1253              <command>ctdb status</command> that all nodes are up and
1254              running and that they are all healthy.  Do not try to
1255              expand a cluster unless it is completely healthy!
1256           </para>
1257         </listitem>
1258         <listitem>
1259           <para>
1260             On all nodes, edit <filename>/usr/local/etc/ctdb/nodes</filename>
1261             and <emphasis>add the new nodes at the end of this
1262             file</emphasis>.
1263           </para>
1264         </listitem>
1265         <listitem>
1266           <para>
1267             Verify that all the nodes have identical
1268             <filename>/usr/local/etc/ctdb/nodes</filename> files after adding
1269             the new nodes.
1270           </para>
1271         </listitem>
1272         <listitem>
1273           <para>
1274             Run <command>ctdb reloadnodes</command> to force all nodes
1275             to reload the nodes file.
1276           </para>
1277         </listitem>
1278         <listitem>
1279           <para>
1280             Use <command>ctdb status</command> on all nodes and verify
1281             that they now show the additional nodes.
1282           </para>
1283         </listitem>
1284         <listitem>
1285           <para>
1286             Install and configure the new node and bring it online.
1287           </para>
1288         </listitem>
1289       </orderedlist>
1290       <para>
1291         Procedure to remove nodes:
1292       </para>
1293       <orderedlist>
1294         <listitem>
1295           <para>
1296             To remove nodes from an existing cluster, first ensure
1297             with <command>ctdb status</command> that all nodes, except
1298             the node to be deleted, are up and running and that they
1299             are all healthy.  Do not try to remove nodes from a
1300             cluster unless the cluster is completely healthy!
1301           </para>
1302         </listitem>
1303         <listitem>
1304           <para>
1305             Shutdown and power off the node to be removed.
1306           </para>
1307         </listitem>
1308         <listitem>
1309           <para>
1310             On all other nodes, edit the
1311             <filename>/usr/local/etc/ctdb/nodes</filename> file and
1312             <emphasis>comment out</emphasis> the nodes to be removed.
1313             <emphasis>Do not delete the lines for the deleted
1314             nodes</emphasis>, just comment them out by adding a '#' at
1315             the beginning of the lines.
1316           </para>
1317         </listitem>
1318         <listitem>
1319           <para>
1320             Run <command>ctdb reloadnodes</command> to force all nodes
1321             to reload the nodes file.
1322           </para>
1323         </listitem>
1324         <listitem>
1325           <para>
1326             Use <command>ctdb status</command> on all nodes and verify
1327             that the deleted nodes are no longer listed.
1328           </para>
1329         </listitem>
1330       </orderedlist>
1332     </refsect2>
1334     <refsect2>
1335       <title>
1336         reloadips
1337         <optional><parameter>PNN-LIST</parameter></optional>
1338       </title>
1339       <para>
1340         This command reloads the public addresses configuration file
1341         on the specified nodes.  When it completes addresses will be
1342         reconfigured and reassigned across the cluster as necessary.
1343       </para>
1345       <para>
1346         This command is currently unable to make changes to the
1347         netmask or interfaces associated with existing addresses.
1348         Such changes must be made in 2 steps by deleting addresses in
1349         question and re-adding then.  Unfortunately this will disrupt
1350         connections to the changed addresses.
1351       </para>
1352     </refsect2>
1354     <refsect2>
1355       <title>getdbmap</title>
1356       <para>
1357         This command lists all clustered TDB databases that the CTDB
1358         daemon has attached to. Some databases are flagged as PERSISTENT,
1359         this means that the database stores data persistently and the
1360         data will remain across reboots. One example of such a database
1361         is secrets.tdb where information about how the cluster was joined
1362         to the domain is stored.  Some database are flagged as REPLICATED,
1363         this means that the data in that database is replicated across all
1364         the nodes.  But the data will not remain across reboots.  This
1365         type of database is used by CTDB to store it's internal state.
1366       </para>
1367       <para>
1368         If a PERSISTENT database is not in a healthy state the database
1369         is flagged as UNHEALTHY. If there's at least one completely
1370         healthy node running in the cluster, it's possible that the
1371         content is restored by a recovery run automatically. Otherwise an
1372         administrator needs to analyze the problem.
1373       </para>
1374       <para>
1375         See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1376         "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1377         and (if samba or tdb-utils are installed) "tdbtool check".
1378       </para>
1379       <para>
1380         Most databases are not persistent and only store the state
1381         information that the currently running samba daemons need. These
1382         databases are always wiped when ctdb/samba starts and when a
1383         node is rebooted.
1384       </para>
1386       <refsect3>
1387         <title>Example</title>
1388         <screen>
1389 # ctdb getdbmap
1390 Number of databases:10
1391 dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
1392 dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
1393 dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
1394 dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
1395 dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
1396 dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
1397 dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1398 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
1399 dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1400 dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
1402 # ctdb getdbmap  # example for unhealthy database
1403 Number of databases:1
1404 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1406 # ctdb -X getdbmap
1407 |ID|Name|Path|Persistent|Unhealthy|
1408 |0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
1409         </screen>
1410       </refsect3>
1411     </refsect2>
1413     <refsect2>
1414       <title>
1415         backupdb
1416         <parameter>DB</parameter>
1417         <parameter>FILE</parameter>
1418       </title>
1419       <para>
1420         Copy the contents of database DB to FILE.  FILE can later be
1421         read back using <command>restoredb</command>.  This is mainly
1422         useful for backing up persistent databases such as
1423         <filename>secrets.tdb</filename> and similar.
1424       </para>
1425     </refsect2>
1427     <refsect2>
1428       <title>
1429         restoredb
1430         <parameter>FILE</parameter>
1431         <optional><parameter>DB</parameter></optional>
1432       </title>
1433       <para>
1434         This command restores a persistent database that was
1435         previously backed up using backupdb.  By default the data will
1436         be restored back into the same database as it was created
1437         from. By specifying dbname you can restore the data into a
1438         different database.
1439       </para>
1440     </refsect2>
1442     <refsect2>
1443       <title>setdbreadonly <parameter>DB</parameter></title>
1444       <para>
1445         This command will enable the read-only record support for a
1446         database.  This is an experimental feature to improve
1447         performance for contended records primarily in locking.tdb and
1448         brlock.tdb.  When enabling this feature you must set it on all
1449         nodes in the cluster.
1450       </para>
1451     </refsect2>
1453     <refsect2>
1454       <title>setdbsticky <parameter>DB</parameter></title>
1455       <para>
1456         This command will enable the sticky record support for the
1457         specified database.  This is an experimental feature to
1458         improve performance for contended records primarily in
1459         locking.tdb and brlock.tdb.  When enabling this feature you
1460         must set it on all nodes in the cluster.
1461       </para>
1462     </refsect2>
1464   </refsect1>
1466   <refsect1>
1467     <title>INTERNAL COMMANDS</title>
1469     <para>
1470       Internal commands are used by CTDB's scripts and are not
1471       required for managing a CTDB cluster.  Their parameters and
1472       behaviour are subject to change.
1473     </para>
1475     <refsect2>
1476       <title>gettickles <parameter>IPADDR</parameter></title>
1477       <para>
1478         Show TCP connections that are registered with CTDB to be
1479         "tickled" if there is a failover.
1480       </para>
1481     </refsect2>
1483     <refsect2>
1484       <title>gratarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1485       <para>
1486         Send out a gratuitous ARP for the specified interface through
1487         the specified interface. This command is mainly used by the
1488         ctdb eventscripts.
1489       </para>
1490     </refsect2>
1492     <refsect2>
1493       <title>
1494         pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1495       </title>
1496       <para>
1497         Delete KEY from DB.
1498       </para>
1499     </refsect2>
1501     <refsect2>
1502       <title>
1503         pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1504       </title>
1505       <para>
1506         Print the value associated with KEY in DB.
1507       </para>
1508     </refsect2>
1510     <refsect2>
1511       <title>
1512         pstore
1513         <parameter>DB</parameter>
1514         <parameter>KEY</parameter>
1515         <parameter>FILE</parameter>
1516       </title>
1517       <para>
1518         Store KEY in DB with contents of FILE as the associated value.
1519       </para>
1520     </refsect2>
1522     <refsect2>
1523       <title>
1524         ptrans
1525         <parameter>DB</parameter>
1526         <optional><parameter>FILE</parameter></optional>
1527       </title>
1528       <para>
1529         Read a list of key-value pairs, one per line from FILE, and
1530         store them in DB using a single transaction.  An empty value
1531         is equivalent to deleting the given key.
1532       </para>
1533       <para>
1534         The key and value should be separated by spaces or tabs. Each
1535         key/value should be a printable string enclosed in
1536         double-quotes.
1537       </para>
1538     </refsect2>
1540     <refsect2>
1541       <title>runstate [setup|first_recovery|startup|running]</title>
1542       <para>
1543         Print the runstate of the specified node.  Runstates are used
1544         to serialise important state transitions in CTDB, particularly
1545         during startup.
1546       </para>
1547       <para>
1548         If one or more optional runstate arguments are specified then
1549         the node must be in one of these runstates for the command to
1550         succeed.
1551       </para>
1552       <refsect3>
1553         <title>Example</title>
1554         <screen>
1555 # ctdb runstate
1556 RUNNING
1557         </screen>
1558       </refsect3>
1559     </refsect2>
1561     <refsect2>
1562       <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1563       <para>
1564         Set the internal state of network interface IFACE.  This is
1565         typically used in the <filename>10.interface</filename> script
1566         in the "monitor" event.
1567       </para>
1568       <para>
1569         Example: ctdb setifacelink eth0 up
1570       </para>
1571     </refsect2>
1573     <refsect2>
1574       <title>tickle</title>
1575       <para>
1576         Read a list of TCP connections, one per line, from standard
1577         input and send a TCP tickle to the source host for each
1578         connection.  A connection is specified as:
1579       </para>
1580       <synopsis>
1581         <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1582       </synopsis>
1583       <para>
1584         A single connection can be specified on the command-line
1585         rather than on standard input.
1586       </para>
1587       <para>
1588         A TCP tickle is a TCP ACK packet with an invalid sequence and
1589         acknowledge number and will when received by the source host
1590         result in it sending an immediate correct ACK back to the
1591         other end.
1592       </para>
1593       <para>
1594         TCP tickles are useful to "tickle" clients after a IP failover has
1595         occurred since this will make the client immediately recognize the
1596         TCP connection has been disrupted and that the client will need
1597         to reestablish. This greatly speeds up the time it takes for a client
1598         to detect and reestablish after an IP failover in the ctdb cluster.
1599       </para>
1600     </refsect2>
1602     <refsect2>
1603       <title>version</title>
1604       <para>
1605         Display the CTDB version.
1606       </para>
1607     </refsect2>
1609   </refsect1>
1611   <refsect1>
1612     <title>DEBUGGING COMMANDS</title>
1613     <para>
1614       These commands are primarily used for CTDB development and testing and
1615       should not be used for normal administration.
1616     </para>
1619     <refsect2>
1620       <title>OPTIONS</title>
1622       <variablelist>
1623         <varlistentry><term>--print-emptyrecords</term>
1624         <listitem>
1625           <para>
1626             This enables printing of empty records when dumping databases
1627             with the catdb, cattbd and dumpdbbackup commands. Records with
1628             empty data segment are considered deleted by ctdb and cleaned
1629             by the vacuuming mechanism, so this switch can come in handy for
1630             debugging the vacuuming behaviour.
1631           </para>
1632         </listitem>
1633         </varlistentry>
1635         <varlistentry><term>--print-datasize</term>
1636         <listitem>
1637           <para>
1638             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1639             size of the record data instead of dumping the data contents.
1640           </para>
1641         </listitem>
1642         </varlistentry>
1644         <varlistentry><term>--print-lmaster</term>
1645         <listitem>
1646           <para>
1647             This lets catdb print the lmaster for each record.
1648           </para>
1649         </listitem>
1650         </varlistentry>
1652         <varlistentry><term>--print-hash</term>
1653         <listitem>
1654           <para>
1655             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1656             hash for each record.
1657           </para>
1658         </listitem>
1659         </varlistentry>
1661         <varlistentry><term>--print-recordflags</term>
1662         <listitem>
1663           <para>
1664             This lets catdb and dumpdbbackup print the
1665             record flags for each record. Note that cattdb always
1666             prints the flags.
1667           </para>
1668         </listitem>
1669         </varlistentry>
1671       </variablelist>
1672     </refsect2>
1674     <refsect2>
1675       <title>process-exists <parameter>PID</parameter> <parameter>[SRVID]</parameter></title>
1676       <para>
1677         This command checks if a specific process exists on the CTDB
1678         host. This is mainly used by Samba to check if remote instances
1679         of samba are still running or not.  When the optional SRVID
1680         argument is specified, the command check if a specific process
1681         exists on the CTDB host and has registered for specified SRVID.
1682       </para>
1683     </refsect2>
1685     <refsect2>
1686       <title>getdbstatus <parameter>DB</parameter></title>
1687       <para>
1688         This command displays more details about a database.
1689       </para>
1690       <refsect3>
1691         <title>Example</title>
1692         <screen>
1693 # ctdb getdbstatus test.tdb.0
1694 dbid: 0x122224da
1695 name: test.tdb
1696 path: /usr/local/var/lib/ctdb/test.tdb.0
1697 PERSISTENT: no
1698 HEALTH: OK
1700 # ctdb getdbstatus registry.tdb  # with a corrupted TDB
1701 dbid: 0xf2a58948
1702 name: registry.tdb
1703 path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
1704 PERSISTENT: yes
1705 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1706         </screen>
1707       </refsect3>
1708     </refsect2>
1710     <refsect2>
1711       <title>catdb <parameter>DB</parameter></title>
1712       <para>
1713         Print a dump of the clustered TDB database DB.
1714       </para>
1715     </refsect2>
1717     <refsect2>
1718       <title>cattdb <parameter>DB</parameter></title>
1719       <para>
1720         Print a dump of the contents of the local TDB database DB.
1721       </para>
1722     </refsect2>
1724     <refsect2>
1725       <title>dumpdbbackup <parameter>FILE</parameter></title>
1726       <para>
1727         Print a dump of the contents from database backup FILE,
1728         similar to <command>catdb</command>.
1729       </para>
1730     </refsect2>
1732     <refsect2>
1733       <title>wipedb <parameter>DB</parameter></title>
1734       <para>
1735         Remove all contents of database DB.
1736       </para>
1737     </refsect2>
1739     <refsect2>
1740       <title>recover</title>
1741       <para>
1742         This command will trigger the recovery daemon to do a cluster
1743         recovery.
1744       </para>
1745     </refsect2>
1747     <refsect2>
1748       <title>ipreallocate, sync</title>
1749       <para>
1750         This command will force the leader to perform a full ip
1751         reallocation process and redistribute all ip addresses. This
1752         is useful to "reset" the allocations back to its default state
1753         if they have been changed using the "moveip" command. While a
1754         "recover" will also perform this reallocation, a recovery is
1755         much more hevyweight since it will also rebuild all the
1756         databases.
1757       </para>
1758     </refsect2>
1760     <refsect2>
1761       <title>attach <parameter>DBNAME</parameter> [persistent|replicated]</title>
1762       <para>
1763         Create a new CTDB database called DBNAME and attach to it on
1764         all nodes.
1765       </para>
1766     </refsect2>
1768     <refsect2>
1769       <title>detach <parameter>DB-LIST</parameter></title>
1770       <para>
1771         Detach specified non-persistent database(s) from the cluster. This
1772         command will disconnect specified database(s) on all nodes in
1773         the cluster.  This command should only be used when none of the
1774         specified database(s) are in use.
1775       </para>
1776       <para>
1777         All nodes should be active and tunable AllowClientDBAccess should
1778         be disabled on all nodes before detaching databases.
1779       </para>
1780     </refsect2>
1782     <refsect2>
1783       <title>dumpmemory</title>
1784       <para>
1785         This is a debugging command. This command will make the ctdb
1786         daemon to write a fill memory allocation map to standard output.
1787       </para>
1788     </refsect2>
1790     <refsect2>
1791       <title>rddumpmemory</title>
1792       <para>
1793         This is a debugging command. This command will dump the talloc memory
1794         allocation tree for the recovery daemon to standard output.
1795       </para>
1796     </refsect2>
1798     <refsect2>
1799       <title>ban <parameter>BANTIME</parameter></title>
1800       <para>
1801         Administratively ban a node for BANTIME seconds.  The node
1802         will be unbanned after BANTIME seconds have elapsed.
1803       </para>
1804       <para>
1805         A banned node does not participate in the cluster.  It does
1806         not host any records for the clustered TDB and does not host
1807         any public IP addresses.
1808       </para>
1809       <para>
1810         Nodes are automatically banned if they misbehave.  For
1811         example, a node may be banned if it causes too many cluster
1812         recoveries.
1813       </para>
1814       <para>
1815         To administratively exclude a node from a cluster use the
1816         <command>stop</command> command.
1817       </para>
1818     </refsect2>
1820     <refsect2>
1821       <title>unban</title>
1822       <para>
1823         This command is used to unban a node that has either been
1824         administratively banned using the ban command or has been
1825         automatically banned.
1826       </para>
1827     </refsect2>
1829   </refsect1>
1831   <!-- UNDOCUMENTED: stats
1832        addtickle deltickle
1833        tfetch tstore readkey writekey
1834        checktcpport getdbseqnum
1835   -->
1837   <refsect1>
1838     <title>SEE ALSO</title>
1839     <para>
1840       <citerefentry><refentrytitle>ctdbd</refentrytitle>
1841       <manvolnum>1</manvolnum></citerefentry>,
1843       <citerefentry><refentrytitle>onnode</refentrytitle>
1844       <manvolnum>1</manvolnum></citerefentry>,
1846       <citerefentry><refentrytitle>ctdb</refentrytitle>
1847       <manvolnum>7</manvolnum></citerefentry>,
1849       <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1850       <manvolnum>7</manvolnum></citerefentry>,
1852       <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1853       <manvolnum>7</manvolnum></citerefentry>,
1855       <ulink url="http://ctdb.samba.org/"/>
1856     </para>
1857   </refsect1>
1860 </refentry>