ctdb-doc: Add reference to new magepage ctdb-statistics
[vlendec/samba-autobuild/.git] / ctdb / doc / ctdb.1.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
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">
6
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>
16
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>
42
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>
49
50   <refnamediv>
51     <refname>ctdb</refname>
52     <refpurpose>CTDB management utility</refpurpose>
53   </refnamediv>
54
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>
63
64   <refsect1>
65     <title>DESCRIPTION</title>
66     <para>
67       ctdb is a utility to view and manage a CTDB cluster.
68     </para>
69
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>
95
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>
121
122   <refsect1>
123     <title>OPTIONS</title>
124
125     <variablelist>
126       <varlistentry><term>-n <parameter>PNN-LIST</parameter></term>
127       <listitem>
128         <para>
129           The nodes specified by PNN-LIST 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>
135
136       <varlistentry><term>-Y</term>
137       <listitem>
138         <para>
139           Produce output in machine readable form for easier parsing
140           by scripts. Not all commands support this option.
141         </para>
142       </listitem>
143       </varlistentry>
144
145       <varlistentry><term>-t <parameter>TIMEOUT</parameter></term>
146       <listitem>
147         <para>
148           Indicates that ctdb should wait up to TIMEOUT seconds for
149           a response to most commands sent to the CTDB daemon.  The
150           default is 10 seconds.
151         </para>
152       </listitem>
153       </varlistentry>
154
155       <varlistentry><term>-T <parameter>TIMELIMIT</parameter></term>
156       <listitem>
157         <para>
158           Indicates that TIMELIMIT is the maximum run time (in
159           seconds) for the ctdb command.  When TIMELIMIT is exceeded
160           the ctdb command will terminate with an error.  The default
161           is 120 seconds.
162         </para>
163       </listitem>
164       </varlistentry>
165
166       <varlistentry><term>-? --help</term>
167       <listitem>
168         <para>
169           Print some help text to the screen.
170         </para>
171       </listitem>
172       </varlistentry>
173
174       <varlistentry><term>--usage</term>
175       <listitem>
176         <para>
177           Print useage information to the screen.
178         </para>
179       </listitem>
180       </varlistentry>
181
182       <varlistentry><term>-d --debug=<parameter>DEBUGLEVEL</parameter></term>
183       <listitem>
184         <para>
185           Change the debug level for the command. Default is ERR (0).
186         </para>
187       </listitem>
188       </varlistentry>
189
190       <varlistentry><term>--socket=<parameter>FILENAME</parameter></term>
191       <listitem>
192         <para>
193           Specify that FILENAME is the name of the Unix domain
194           socket to use when connecting to the local CTDB
195           daemon. The default is
196           <filename>/tmp/ctdb.socket</filename>.
197         </para>
198       </listitem>
199       </varlistentry>
200     </variablelist>
201   </refsect1>
202
203
204   <refsect1>
205     <title>ADMINISTRATIVE COMMANDS</title>
206     <para>
207       These are commands used to monitor and administer a CTDB cluster.
208     </para>
209
210     <refsect2>
211       <title>pnn</title>
212       <para>
213         This command displays the PNN of the current node.
214       </para>
215     </refsect2>
216
217     <refsect2>
218       <title>xpnn</title>
219       <para>
220         This command displays the PNN of the current node without
221         contacting the CTDB daemon.  It parses the nodes file
222         directly, so can produce unexpected output if the nodes file
223         has been edited but has not been reloaded.
224       </para>
225     </refsect2>
226
227     <refsect2>
228       <title>status</title>
229       <para>
230         This command shows the current status of all CTDB nodes based
231         on information from the queried node.
232       </para>
233
234       <para>
235         Note: If the the queried node is INACTIVE then the status
236         might not be current.
237       </para>
238
239       <refsect3>
240         <title>Node status</title>
241         <para>
242           This includes the number of physical nodes and the status of
243           each node.  See <citerefentry><refentrytitle>ctdb</refentrytitle>
244           <manvolnum>7</manvolnum></citerefentry> for information
245           about node states.
246         </para>
247       </refsect3>
248
249       <refsect3>
250         <title>Generation</title>
251         <para>
252           The generation id is a number that indicates the current generation 
253           of a cluster instance. Each time a cluster goes through a 
254           reconfiguration or a recovery its generation id will be changed.
255         </para>
256         <para>
257           This number does not have any particular meaning other than
258           to keep track of when a cluster has gone through a
259           recovery. It is a random number that represents the current
260           instance of a ctdb cluster and its databases.  The CTDB
261           daemon uses this number internally to be able to tell when
262           commands to operate on the cluster and the databases was
263           issued in a different generation of the cluster, to ensure
264           that commands that operate on the databases will not survive
265           across a cluster database recovery.  After a recovery, all
266           old outstanding commands will automatically become invalid.
267         </para>
268         <para>
269           Sometimes this number will be shown as "INVALID". This only means that
270           the ctdbd daemon has started but it has not yet merged with the cluster through a recovery.
271           All nodes start with generation "INVALID" and are not assigned a real
272           generation id until they have successfully been merged with a cluster
273           through a recovery.
274         </para>
275       </refsect3>
276
277       <refsect3>
278         <title>Virtual Node Number (VNN) map</title>
279         <para>
280           Consists of the number of virtual nodes and mapping from
281           virtual node numbers to physical node numbers.  Virtual
282           nodes host CTDB databases.  Only nodes that are
283           participating in the VNN map can become lmaster or dmaster
284           for database records.
285         </para>
286       </refsect3>
287
288       <refsect3>
289         <title>Recovery mode</title>
290         <para>
291           This is the current recovery mode of the cluster. There are two possible modes:
292         </para>
293         <para>
294           NORMAL - The cluster is fully operational.
295         </para>
296         <para>
297           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.
298         </para>
299         <para>
300           Once the recovery master detects an inconsistency, for example a node 
301           becomes disconnected/connected, the recovery daemon will trigger a 
302           cluster recovery process, where all databases are remerged across the
303           cluster. When this process starts, the recovery master will first
304           "freeze" all databases to prevent applications such as samba from 
305           accessing the databases and it will also mark the recovery mode as
306           RECOVERY.
307         </para>
308         <para>
309           When the CTDB daemon starts up, it will start in RECOVERY
310           mode.  Once the node has been merged into a cluster and all
311           databases have been recovered, the node mode will change into
312           NORMAL mode and the databases will be "thawed", allowing samba
313           to access the databases again.
314         </para>
315       </refsect3>
316       <refsect3>
317         <title>Recovery master</title>
318         <para>
319           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.
320         </para>
321         <para>
322           Only one node at a time can be the designated recovery master. Which
323           node is designated the recovery master is decided by an election
324           process in the recovery daemons running on each node.
325         </para>
326       </refsect3>
327
328       <refsect3>
329         <title>Example</title>
330         <screen>
331 # ctdb status
332 Number of nodes:4
333 pnn:0 192.168.2.200       OK (THIS NODE)
334 pnn:1 192.168.2.201       OK
335 pnn:2 192.168.2.202       OK
336 pnn:3 192.168.2.203       OK
337 Generation:1362079228
338 Size:4
339 hash:0 lmaster:0
340 hash:1 lmaster:1
341 hash:2 lmaster:2
342 hash:3 lmaster:3
343 Recovery mode:NORMAL (0)
344 Recovery master:0
345         </screen>
346       </refsect3>
347     </refsect2>
348
349     <refsect2>
350       <title>nodestatus <optional><parameter>PNN-LIST</parameter></optional></title>
351       <para>
352         This command is similar to the <command>status</command>
353         command.  It displays the "node status" subset of output.  The
354         main differences are:
355       </para>
356
357       <itemizedlist>
358         <listitem>
359           <para>
360             The exit code is the bitwise-OR of the flags for each
361             specified node, while <command>ctdb status</command> exits
362             with 0 if it was able to retrieve status for all nodes.
363           </para>
364         </listitem>
365
366         <listitem>
367           <para>
368             <command>ctdb status</command> provides status information
369             for all nodes.  <command>ctdb nodestatus</command>
370             defaults to providing status for only the current node.
371             If PNN-LIST is provided then status is given for
372             the indicated node(s).
373           </para>
374
375           <para>
376             By default, <command>ctdb nodestatus</command> gathers
377             status from the local node.  However, if invoked with "-n
378             all" (or similar) then status is gathered from the given
379             node(s).  In particular <command>ctdb nodestatus
380             all</command> and <command>ctdb nodestatus -n
381             all</command> will produce different output.  It is
382             possible to provide 2 different nodespecs (with and
383             without "-n") but the output is usually confusing!
384           </para>
385         </listitem>
386       </itemizedlist>
387
388       <para>
389         A common invocation in scripts is <command>ctdb nodestatus
390         all</command> to check whether all nodes in a cluster are
391         healthy.
392       </para>
393
394       <refsect3>
395         <title>Example</title>
396         <screen>
397 # ctdb nodestatus
398 pnn:0 10.0.0.30        OK (THIS NODE)
399
400 # ctdb nodestatus all
401 Number of nodes:2
402 pnn:0 10.0.0.30        OK (THIS NODE)
403 pnn:1 10.0.0.31        OK
404         </screen>
405       </refsect3>
406     </refsect2>
407
408     <refsect2>
409       <title>recmaster</title>
410       <para>
411         This command shows the pnn of the node which is currently the recmaster.
412       </para>
413
414       <para>
415         Note: If the the queried node is INACTIVE then the status
416         might not be current.
417       </para>
418     </refsect2>
419
420     <refsect2>
421       <title>uptime</title>
422       <para>
423         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.
424       </para>
425
426       <refsect3>
427         <title>Example</title>
428         <screen>
429 # ctdb uptime
430 Current time of node          :                Thu Oct 29 10:38:54 2009
431 Ctdbd start time              : (000 16:54:28) Wed Oct 28 17:44:26 2009
432 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
433 Duration of last recovery/failover: 2.248552 seconds
434         </screen>
435       </refsect3>
436     </refsect2>
437
438     <refsect2>
439       <title>listnodes</title>
440       <para>
441         This command shows lists the ip addresses of all the nodes in the cluster.
442       </para>
443
444       <refsect3>
445         <title>Example</title>
446         <screen>
447 # ctdb listnodes
448 192.168.2.200
449 192.168.2.201
450 192.168.2.202
451 192.168.2.203
452         </screen>
453       </refsect3>
454     </refsect2>
455
456     <refsect2>
457       <title>natgwlist</title>
458       <para>
459         Show the current NAT gateway master and the status of all
460         nodes in the current NAT gateway group.  See the
461         <citetitle>NAT GATEWAY</citetitle> section in
462         <citerefentry><refentrytitle>ctdb</refentrytitle>
463         <manvolnum>7</manvolnum></citerefentry> for more details.
464       </para>
465
466       <refsect3>
467         <title>Example</title>
468         <screen>
469 # ctdb natgwlist
470 0 192.168.2.200
471 Number of nodes:4
472 pnn:0 192.168.2.200       OK (THIS NODE)
473 pnn:1 192.168.2.201       OK
474 pnn:2 192.168.2.202       OK
475 pnn:3 192.168.2.203       OK
476         </screen>
477       </refsect3>
478     </refsect2>
479
480     <refsect2>
481       <title>ping</title>
482       <para>
483         This command will "ping" specified CTDB nodes in the cluster
484         to verify that they are running.
485       </para>
486       <refsect3>
487         <title>Example</title>
488         <screen>
489 # ctdb ping -n all
490 response from 0 time=0.000054 sec  (3 clients)
491 response from 1 time=0.000144 sec  (2 clients)
492 response from 2 time=0.000105 sec  (2 clients)
493 response from 3 time=0.000114 sec  (2 clients)
494         </screen>
495       </refsect3>
496     </refsect2>
497
498     <refsect2>
499       <title>ifaces</title>
500       <para>
501         This command will display the list of network interfaces, which could
502         host public addresses, along with their status.
503       </para>
504       <refsect3>
505         <title>Example</title>
506         <screen>
507 # ctdb ifaces
508 Interfaces on node 0
509 name:eth5 link:up references:2
510 name:eth4 link:down references:0
511 name:eth3 link:up references:1
512 name:eth2 link:up references:1
513
514 # ctdb ifaces -Y
515 :Name:LinkStatus:References:
516 :eth5:1:2
517 :eth4:0:0
518 :eth3:1:1
519 :eth2:1:1
520         </screen>
521       </refsect3>
522     </refsect2>
523
524     <refsect2>
525       <title>ip</title>
526       <para>
527         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 -n all".
528       </para>
529       <refsect3>
530         <title>Example</title>
531         <screen>
532 # ctdb ip
533 Public IPs on node 0
534 172.31.91.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
535 172.31.91.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
536 172.31.91.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
537 172.31.91.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
538 172.31.92.82 node[1] active[] available[eth5] configured[eth4,eth5]
539 172.31.92.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
540 172.31.92.84 node[1] active[] available[eth5] configured[eth4,eth5]
541 172.31.92.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
542
543 # ctdb ip -Y
544 :Public IP:Node:ActiveInterface:AvailableInterfaces:ConfiguredInterfaces:
545 :172.31.91.82:1::eth2,eth3:eth2,eth3:
546 :172.31.91.83:0:eth3:eth2,eth3:eth2,eth3:
547 :172.31.91.84:1::eth2,eth3:eth2,eth3:
548 :172.31.91.85:0:eth2:eth2,eth3:eth2,eth3:
549 :172.31.92.82:1::eth5:eth4,eth5:
550 :172.31.92.83:0:eth5:eth5:eth4,eth5:
551 :172.31.92.84:1::eth5:eth4,eth5:
552 :172.31.92.85:0:eth5:eth5:eth4,eth5:
553         </screen>
554       </refsect3>
555     </refsect2>
556
557     <refsect2>
558       <title>ipinfo <parameter>IP</parameter></title>
559       <para>
560         This command will display details about the specified public addresses.
561       </para>
562       <refsect3>
563         <title>Example</title>
564         <screen>
565 # ctdb ipinfo 172.31.92.85
566 Public IP[172.31.92.85] info on node 0
567 IP:172.31.92.85
568 CurrentNode:0
569 NumInterfaces:2
570 Interface[1]: Name:eth4 Link:down References:0
571 Interface[2]: Name:eth5 Link:up References:2 (active)
572         </screen>
573       </refsect3>
574     </refsect2>
575
576     <refsect2>
577       <title>scriptstatus</title>
578       <para>
579         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.
580       </para>
581       <refsect3>
582         <title>Example</title>
583         <screen>
584 # ctdb scriptstatus
585 7 scripts were executed last monitoring cycle
586 00.ctdb              Status:OK    Duration:0.056 Tue Mar 24 18:56:57 2009
587 10.interface         Status:OK    Duration:0.077 Tue Mar 24 18:56:57 2009
588 11.natgw             Status:OK    Duration:0.039 Tue Mar 24 18:56:57 2009
589 20.multipathd        Status:OK    Duration:0.038 Tue Mar 24 18:56:57 2009
590 31.clamd             Status:DISABLED
591 40.vsftpd            Status:OK    Duration:0.045 Tue Mar 24 18:56:57 2009
592 41.httpd             Status:OK    Duration:0.039 Tue Mar 24 18:56:57 2009
593 50.samba             Status:ERROR    Duration:0.082 Tue Mar 24 18:56:57 2009
594 OUTPUT:ERROR: Samba tcp port 445 is not responding
595       </screen>
596       </refsect3>
597     </refsect2>
598
599     <refsect2>
600       <title>disablescript <parameter>SCRIPT</parameter></title>
601       <para>
602         This command is used to disable an eventscript.
603       </para>
604       <para>
605         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'.
606       </para>
607     </refsect2>
608
609     <refsect2>
610       <title>enablescript <parameter>SCRIPT</parameter></title>
611       <para>
612         This command is used to enable an eventscript.
613       </para>
614       <para>
615         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'.
616       </para>
617     </refsect2>
618
619     <refsect2>
620       <title>listvars</title>
621       <para>
622         List all tuneable variables, except the values of the obsolete tunables
623         like VacuumMinInterval. The obsolete tunables can be retrieved only
624         explicitly with the "ctdb getvar" command.
625       </para>
626       <refsect3>
627         <title>Example</title>
628         <screen>
629 # ctdb listvars
630 MaxRedirectCount        = 3
631 SeqnumInterval          = 1000
632 ControlTimeout          = 60
633 TraverseTimeout         = 20
634 KeepaliveInterval       = 5
635 KeepaliveLimit          = 5
636 RecoverTimeout          = 20
637 RecoverInterval         = 1
638 ElectionTimeout         = 3
639 TakeoverTimeout         = 9
640 MonitorInterval         = 15
641 TickleUpdateInterval    = 20
642 EventScriptTimeout      = 30
643 EventScriptTimeoutCount = 1
644 RecoveryGracePeriod     = 120
645 RecoveryBanPeriod       = 300
646 DatabaseHashSize        = 100001
647 DatabaseMaxDead         = 5
648 RerecoveryTimeout       = 10
649 EnableBans              = 1
650 DeterministicIPs        = 0
651 LCP2PublicIPs           = 1
652 ReclockPingPeriod       = 60
653 NoIPFailback            = 0
654 DisableIPFailover       = 0
655 VerboseMemoryNames      = 0
656 RecdPingTimeout         = 60
657 RecdFailCount           = 10
658 LogLatencyMs            = 0
659 RecLockLatencyMs        = 1000
660 RecoveryDropAllIPs      = 120
661 VerifyRecoveryLock      = 1
662 VacuumInterval          = 10
663 VacuumMaxRunTime        = 30
664 RepackLimit             = 10000
665 VacuumLimit             = 5000
666 VacuumFastPathCount     = 60
667 MaxQueueDropMsg         = 1000000
668 UseStatusEvents         = 0
669 AllowUnhealthyDBRead    = 0
670 StatHistoryInterval     = 1
671 DeferredAttachTO        = 120
672 AllowClientDBAttach     = 1
673 RecoverPDBBySeqNum      = 0
674         </screen>
675       </refsect3>
676     </refsect2>
677
678     <refsect2>
679       <title>getvar <parameter>NAME</parameter></title>
680       <para>
681         Get the runtime value of a tuneable variable.
682       </para>
683       <refsect3>
684         <title>Example</title>
685         <screen>
686 # ctdb getvar MaxRedirectCount
687 MaxRedirectCount    = 3
688         </screen>
689       </refsect3>
690     </refsect2>
691
692     <refsect2>
693       <title>setvar <parameter>NAME</parameter> <parameter>VALUE</parameter></title>
694       <para>
695         Set the runtime value of a tuneable variable.
696       </para>
697       <para>
698         Example: ctdb setvar MaxRedirectCount 5
699       </para>
700     </refsect2>
701
702     <refsect2>
703       <title>lvsmaster</title>
704       <para>
705         This command shows which node is currently the LVSMASTER. The
706         LVSMASTER is the node in the cluster which drives the LVS system and
707         which receives all incoming traffic from clients.
708       </para>
709       <para>
710         LVS is the mode where the entire CTDB/Samba cluster uses a single
711         ip address for the entire cluster. In this mode all clients connect to
712         one specific node which will then multiplex/loadbalance the clients
713         evenly onto the other nodes in the cluster. This is an alternative to using
714         public ip addresses. See the manpage for ctdbd for more information
715         about LVS.
716       </para>
717     </refsect2>
718
719     <refsect2>
720       <title>lvs</title>
721       <para>
722         This command shows which nodes in the cluster are currently active in the
723         LVS configuration. I.e. which nodes we are currently loadbalancing
724         the single ip address across.
725       </para>
726
727       <para>
728         LVS will by default only loadbalance across those nodes that are both
729         LVS capable and also HEALTHY. Except if all nodes are UNHEALTHY in which
730         case LVS will loadbalance across all UNHEALTHY nodes as well.
731         LVS will never use nodes that are DISCONNECTED, STOPPED, BANNED or
732         DISABLED.
733       </para>
734
735       <para>
736         Example output:
737       </para>
738       <screen>
739 2:10.0.0.13
740 3:10.0.0.14
741       </screen>
742
743     </refsect2>
744
745
746     <refsect2>
747       <title>getcapabilities</title>
748
749       <para>
750         This command shows the capabilities of the current node.  See
751         the <citetitle>CAPABILITIES</citetitle> section in
752         <citerefentry><refentrytitle>ctdb</refentrytitle>
753         <manvolnum>7</manvolnum></citerefentry> for more details.
754       </para>
755
756       <para>
757         Example output:
758       </para>
759       <screen>
760 RECMASTER: YES
761 LMASTER: YES
762 LVS: NO
763 NATGW: YES
764       </screen>
765
766     </refsect2>
767
768     <refsect2>
769       <title>statistics</title>
770       <para>
771         Collect statistics from the CTDB daemon about
772         how many calls it has served.  Information about
773         various fields in statistics can be found in
774         <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
775         <manvolnum>7</manvolnum></citerefentry>.
776       </para>
777       <refsect3>
778         <title>Example</title>
779         <screen>
780 # ctdb statistics
781 CTDB version 1
782 num_clients                        3
783 frozen                             0
784 recovering                         0
785 client_packets_sent           360489
786 client_packets_recv           360466
787 node_packets_sent             480931
788 node_packets_recv             240120
789 keepalive_packets_sent             4
790 keepalive_packets_recv             3
791 node
792 req_call                       2
793 reply_call                     2
794 req_dmaster                    0
795 reply_dmaster                  0
796 reply_error                    0
797 req_message                   42
798 req_control               120408
799 reply_control             360439
800 client
801 req_call                       2
802 req_message                   24
803 req_control               360440
804 timeouts
805 call                           0
806 control                        0
807 traverse                       0
808 total_calls                        2
809 pending_calls                      0
810 lockwait_calls                     0
811 pending_lockwait_calls             0
812 memory_used                     5040
813 max_hop_count                      0
814 max_call_latency                   4.948321 sec
815 max_lockwait_latency               0.000000 sec
816         </screen>
817       </refsect3>
818     </refsect2>
819
820     <refsect2>
821       <title>statisticsreset</title>
822       <para>
823         This command is used to clear all statistics counters in a node.
824       </para>
825       <para>
826         Example: ctdb statisticsreset
827       </para>
828     </refsect2>
829
830     <refsect2>
831       <title>dbstatistics <parameter>DB</parameter></title>
832       <para>
833         Display statistics about the database DB.  Information
834         about various fields in dbstatistics can be found in
835         <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
836         <manvolnum>7</manvolnum></citerefentry>.
837       </para>
838       <refsect3>
839         <title>Example</title>
840         <screen>
841 # ctdb dbstatistics locking.tdb
842 DB Statistics: locking.tdb
843  ro_delegations                     0
844  ro_revokes                         0
845  locks
846      total                      14356
847      failed                         0
848      current                        0
849      pending                        0
850  hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
851  lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
852  locks_latency      MIN/AVG/MAX     0.001066/0.012686/4.202292 sec out of 14356
853  Num Hot Keys:     1
854      Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
855         </screen>
856       </refsect3>
857     </refsect2>
858
859     <refsect2>
860       <title>getreclock</title>
861       <para>
862         This command is used to show the filename of the reclock file that is used.
863       </para>
864
865       <para>
866         Example output:
867       </para>
868       <screen>
869         Reclock file:/gpfs/.ctdb/shared
870       </screen>
871
872     </refsect2>
873
874     <refsect2>
875       <title>setreclock [filename]</title>
876       <para>
877         This command is used to modify, or clear, the file that is used as the reclock file at runtime. When this command is used, the reclock file checks are disabled. To re-enable the checks the administrator needs to activate the "VerifyRecoveryLock" tunable using "ctdb setvar".
878       </para>
879
880       <para>
881         If run with no parameter this will remove the reclock file completely. If run with a parameter the parameter specifies the new filename to use for the recovery lock.
882       </para>
883
884       <para>
885         This command only affects the runtime settings of a ctdb node and will be lost when ctdb is restarted. For persistent changes to the reclock file setting you must edit /etc/sysconfig/ctdb.
886       </para>
887     </refsect2>
888
889
890
891     <refsect2>
892       <title>getdebug</title>
893       <para>
894         Get the current debug level for the node. the debug level controls what information is written to the log file.
895       </para>
896       <para>
897         The debug levels are mapped to the corresponding syslog levels.
898         When a debug level is set, only those messages at that level and higher
899         levels will be printed.
900       </para>
901       <para>
902         The list of debug levels from highest to lowest are :
903       </para>
904       <para>
905         EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
906       </para>
907     </refsect2>
908
909     <refsect2>
910       <title>setdebug <parameter>DEBUGLEVEL</parameter></title>
911       <para>
912         Set the debug level of a node. This controls what information will be logged.
913       </para>
914       <para>
915         The debuglevel is one of EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
916       </para>
917     </refsect2>
918
919     <refsect2>
920       <title>getpid</title>
921       <para>
922         This command will return the process id of the ctdb daemon.
923       </para>
924     </refsect2>
925
926     <refsect2>
927       <title>disable</title>
928       <para>
929         This command is used to administratively disable a node in the cluster.
930         A disabled node will still participate in the cluster and host
931         clustered TDB records but its public ip address has been taken over by
932         a different node and it no longer hosts any services.
933       </para>
934     </refsect2>
935
936     <refsect2>
937       <title>enable</title>
938       <para>
939         Re-enable a node that has been administratively disabled.
940       </para>
941     </refsect2>
942
943     <refsect2>
944       <title>stop</title>
945       <para>
946         This command is used to administratively STOP a node in the cluster.
947         A STOPPED node is connected to the cluster but will not host any
948         public ip addresse, nor does it participate in the VNNMAP.
949         The difference between a DISABLED node and a STOPPED node is that
950         a STOPPED node does not host any parts of the database which means
951         that a recovery is required to stop/continue nodes.
952       </para>
953     </refsect2>
954
955     <refsect2>
956       <title>continue</title>
957       <para>
958         Re-start a node that has been administratively stopped.
959       </para>
960     </refsect2>
961
962     <refsect2>
963       <title>addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter></title>
964       <para>
965         This command is used to add a new public ip to a node during runtime.
966         This allows public addresses to be added to a cluster without having
967         to restart the ctdb daemons.
968       </para>
969       <para>
970         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.
971         If you want this change to be permanent you must also update the public addresses file manually.
972       </para>
973     </refsect2>
974
975     <refsect2>
976       <title>delip <parameter>IPADDR</parameter></title>
977       <para>
978         This command is used to remove a public ip from a node during runtime.
979         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.
980       </para>
981       <para>
982         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.
983         If you want this change to be permanent you must also update the public addresses file manually.
984       </para>
985     </refsect2>
986
987     <refsect2>
988       <title>moveip <parameter>IPADDR</parameter> <parameter>PNN</parameter></title>
989       <para>
990         This command can be used to manually fail a public ip address to a
991         specific node.
992       </para>
993       <para>
994         In order to manually override the "automatic" distribution of public 
995         ip addresses that ctdb normally provides, this command only works
996         when you have changed the tunables for the daemon to:
997       </para>
998       <para>
999         DeterministicIPs = 0
1000       </para>
1001       <para>
1002         NoIPFailback = 1
1003       </para>
1004     </refsect2>
1005
1006     <refsect2>
1007       <title>shutdown</title>
1008       <para>
1009         This command will shutdown a specific CTDB daemon.
1010       </para>
1011     </refsect2>
1012
1013     <refsect2>
1014       <title>setlmasterrole on|off</title>
1015       <para>
1016         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.
1017       </para>
1018
1019       <para>
1020         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.
1021       </para>
1022       <para>
1023         Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
1024       </para>
1025       <para>
1026         See also "ctdb getcapabilities"
1027       </para>
1028     </refsect2>
1029
1030     <refsect2>
1031       <title>setrecmasterrole on|off</title>
1032       <para>
1033         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.
1034       </para>
1035
1036       <para>
1037         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.
1038       </para>
1039       <para>
1040         See also "ctdb getcapabilities"
1041       </para>
1042     </refsect2>
1043
1044     <refsect2>
1045       <title>reloadnodes</title>
1046       <para>
1047         This command is used when adding new nodes, or removing existing nodes from an existing cluster.
1048       </para>
1049       <para>
1050         Procedure to add a node:
1051       </para>
1052       <para>
1053         1, To expand an existing cluster, first ensure with 'ctdb status' that
1054         all nodes are up and running and that they are all healthy.
1055         Do not try to expand a cluster unless it is completely healthy!
1056       </para>
1057       <para>
1058         2, On all nodes, edit /etc/ctdb/nodes and add the new node as the last
1059         entry to the file. The new node MUST be added to the end of this file!
1060       </para>
1061       <para>
1062         3, Verify that all the nodes have identical /etc/ctdb/nodes files after you edited them and added the new node!
1063       </para>
1064       <para>
1065         4, Run 'ctdb reloadnodes' to force all nodes to reload the nodesfile.
1066       </para>
1067       <para>
1068         5, Use 'ctdb status' on all nodes and verify that they now show the additional node.
1069       </para>
1070       <para>
1071         6, Install and configure the new node and bring it online.
1072       </para>
1073       <para>
1074         Procedure to remove a node:
1075       </para>
1076       <para>
1077         1, To remove a node from an existing cluster, first ensure with 'ctdb status' that
1078         all nodes, except the node to be deleted, are up and running and that they are all healthy.
1079         Do not try to remove a node from a cluster unless the cluster is completely healthy!
1080       </para>
1081       <para>
1082         2, Shutdown and poweroff the node to be removed.
1083       </para>
1084       <para>
1085         3, On all other nodes, edit the /etc/ctdb/nodes file and comment out the node to be removed. Do not delete the line for that node, just comment it out by adding a '#' at the beginning of the line.
1086       </para>
1087       <para>
1088         4, Run 'ctdb reloadnodes' to force all nodes to reload the nodesfile.
1089       </para>
1090       <para>
1091         5, Use 'ctdb status' on all nodes and verify that the deleted node no longer shows up in the list..
1092       </para>
1093       <para>
1094       </para>
1095
1096     </refsect2>
1097
1098     <refsect2>
1099       <title>
1100         reloadips
1101         <optional><parameter>PNN-LIST</parameter></optional>
1102       </title>
1103       <para>
1104         This command reloads the public addresses configuration file
1105         on the specified nodes.  When it completes addresses will be
1106         reconfigured and reassigned across the cluster as necessary.
1107       </para>
1108     </refsect2>
1109
1110     <refsect2>
1111       <title>getdbmap</title>
1112       <para>
1113         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.
1114       </para>
1115       <para>
1116         If a PERSISTENT database is not in a healthy state the database is
1117         flagged as UNHEALTHY. If there's at least one completely healthy node running in
1118         the cluster, it's possible that the content is restored by a recovery
1119         run automaticly. Otherwise an administrator needs to analyze the
1120         problem.
1121       </para>
1122       <para>
1123         See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1124         "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1125         and (if samba or tdb-utils are installed) "tdbtool check".
1126       </para>
1127       <para>
1128         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.
1129       </para>
1130
1131       <refsect3>
1132         <title>Example</title>
1133         <screen>
1134 # ctdb getdbmap
1135 Number of databases:10
1136 dbid:0x435d3410 name:notify.tdb path:/var/ctdb/notify.tdb.0 
1137 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0
1138 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0 
1139 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0 
1140 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0 
1141 dbid:0x122224da name:test.tdb path:/var/ctdb/test.tdb.0 
1142 dbid:0x2672a57f name:idmap2.tdb path:/var/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1143 dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT
1144 dbid:0xe98e08b6 name:group_mapping.tdb path:/var/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1145 dbid:0x7bbbd26c name:passdb.tdb path:/var/ctdb/persistent/passdb.tdb.0 PERSISTENT
1146
1147 # ctdb getdbmap  # example for unhealthy database
1148 Number of databases:1
1149 dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1150
1151 # ctdb -Y getdbmap
1152 :ID:Name:Path:Persistent:Unhealthy:
1153 :0x7bbbd26c:passdb.tdb:/var/ctdb/persistent/passdb.tdb.0:1:0:
1154         </screen>
1155       </refsect3>
1156     </refsect2>
1157
1158     <refsect2>
1159       <title>
1160         backupdb
1161         <parameter>DB</parameter>
1162         <parameter>FILE</parameter>
1163       </title>
1164       <para>
1165         Copy the contents of database DB to FILE.  FILE can later be
1166         read back using <command>restoredb</command>.  This is mainly
1167         useful for backing up persistent databases such as
1168         <filename>secrets.tdb</filename> and similar.
1169       </para>
1170     </refsect2>
1171
1172     <refsect2>
1173       <title>
1174         restoredb
1175         <parameter>FILE</parameter>
1176         <optional><parameter>DB</parameter></optional>
1177       </title>
1178       <para>
1179         This command restores a persistent database that was
1180         previously backed up using backupdb.  By default the data will
1181         be restored back into the same database as it was created
1182         from. By specifying dbname you can restore the data into a
1183         different database.
1184       </para>
1185     </refsect2>
1186
1187     <refsect2>
1188       <title>getlog [<parameter>LEVEL</parameter>] [recoverd]</title>
1189       <para>
1190         In addition to the normal logging to a log file, CTDB also
1191         keeps a in-memory ringbuffer containing the most recent log
1192         entries for all log levels (except DEBUG).
1193       </para>
1194       <para>
1195         This is useful since it allows for keeping continuous logs to a file
1196         at a reasonable non-verbose level, but shortly after an incident has
1197         occured, a much more detailed log can be pulled from memory. This
1198         can allow you to avoid having to reproduce an issue due to the
1199         on-disk logs being of insufficient detail.
1200       </para>
1201       <para>
1202         This command extracts all messages of level or lower log level
1203         from memory and prints it to the screen.  The level is not
1204         specified it defaults to NOTICE.
1205       </para>
1206       <para>
1207         By default, logs are extracted from the main CTDB daemon.  If
1208         the recoverd option is given then logs are extracted from the
1209         recovery daemon.
1210       </para>
1211     </refsect2>
1212
1213     <refsect2>
1214       <title>clearlog [recoverd]</title>
1215       <para>
1216         This command clears the in-memory logging ringbuffer.
1217       </para>
1218       <para>
1219         By default, logs are cleared in the main CTDB daemon.  If the
1220         recoverd option is given then logs are cleared in the recovery
1221         daemon.
1222       </para>
1223     </refsect2>
1224
1225     <refsect2>
1226       <title>setdbreadonly <parameter>DB</parameter></title>
1227       <para>
1228         This command will enable the read-only record support for a
1229         database.  This is an experimental feature to improve
1230         performance for contended records primarily in locking.tdb and
1231         brlock.tdb.  When enabling this feature you must set it on all
1232         nodes in the cluster.
1233       </para>
1234     </refsect2>
1235
1236     <refsect2>
1237       <title>setdbsticky <parameter>DB</parameter></title>
1238       <para>
1239         This command will enable the sticky record support for the
1240         specified database.  This is an experimental feature to
1241         improve performance for contended records primarily in
1242         locking.tdb and brlock.tdb.  When enabling this feature you
1243         must set it on all nodes in the cluster.
1244       </para>
1245     </refsect2>
1246
1247   </refsect1>
1248
1249   <refsect1>
1250     <title>INTERNAL COMMANDS</title>
1251
1252     <para>
1253       Internal commands are used by CTDB's scripts and are not
1254       required for managing a CTDB cluster.  Their parameters and
1255       behaviour are subject to change.
1256     </para>
1257
1258     <refsect2>
1259       <title>gettickles <parameter>IPADDR</parameter></title>
1260       <para>
1261         Show TCP connections that are registered with CTDB to be
1262         "tickled" if there is a failover.
1263       </para>
1264     </refsect2>
1265
1266     <refsect2>
1267       <title>gratiousarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1268       <para>
1269         Send out a gratious ARP for the specified interface through
1270         the specified interface. This command is mainly used by the
1271         ctdb eventscripts.
1272       </para>
1273     </refsect2>
1274
1275     <refsect2>
1276       <title>killtcp</title>
1277       <para>
1278         Read a list of TCP connections, one per line, from standard
1279         input and terminate each connection.  A connection is
1280         specified as:
1281       </para>
1282       <synopsis>
1283         <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1284       </synopsis>
1285       <para>
1286         Each connection is terminated by issuing a TCP RST to the
1287         SRC-IPADDR:SRC-PORT endpoint.
1288       </para>
1289       <para>
1290         A single connection can be specified on the command-line
1291         rather than on standard input.
1292       </para>
1293     </refsect2>
1294
1295     <refsect2>
1296       <title>
1297         pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1298       </title>
1299       <para>
1300         Delete KEY from DB.
1301       </para>
1302     </refsect2>
1303
1304     <refsect2>
1305       <title>
1306         pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1307       </title>
1308       <para>
1309         Print the value associated with KEY in DB.
1310       </para>
1311     </refsect2>
1312
1313     <refsect2>
1314       <title>
1315         pstore
1316         <parameter>DB</parameter>
1317         <parameter>KEY</parameter>
1318         <parameter>FILE</parameter>
1319       </title>
1320       <para>
1321         Store KEY in DB with contents of FILE as the associated value.
1322       </para>
1323     </refsect2>
1324
1325     <refsect2>
1326       <title>
1327         ptrans
1328         <parameter>DB</parameter>
1329         <optional><parameter>FILE</parameter></optional>
1330       </title>
1331       <para>
1332         Read a list of key-value pairs, one per line from FILE, and
1333         store them in DB using a single transaction.  An empty value
1334         is equivalent to deleting the given key.
1335       </para>
1336       <para>
1337         The key and value should be separated by spaces or tabs. Each
1338         key/value should be a printable string enclosed in
1339         double-quotes.
1340       </para>
1341     </refsect2>
1342
1343     <refsect2>
1344       <title>runstate [setup|first_recovery|startup|running]</title>
1345       <para>
1346         Print the runstate of the specified node.  Runstates are used
1347         to serialise important state transitions in CTDB, particularly
1348         during startup.
1349       </para>
1350       <para>
1351         If one or more optional runstate arguments are specified then
1352         the node must be in one of these runstates for the command to
1353         succeed.
1354       </para>
1355       <refsect3>
1356         <title>Example</title>
1357         <screen>
1358 # ctdb runstate
1359 RUNNING
1360         </screen>
1361       </refsect3>
1362     </refsect2>
1363
1364     <refsect2>
1365       <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1366       <para>
1367         Set the internal state of network interface IFACE.  This is
1368         typically used in the <filename>10.interface</filename> script
1369         in the "monitor" event.
1370       </para>
1371       <para>
1372         Example: ctdb setifacelink eth0 up
1373       </para>
1374     </refsect2>
1375
1376     <refsect2>
1377       <title>setnatgwstate on|off</title>
1378       <para>
1379         Enable or disable the NAT gateway master capability on a node.
1380       </para>
1381     </refsect2>
1382
1383     <refsect2>
1384       <title>tickle <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter></title>
1385       <para>
1386         Send a TCP tickle to the source host for the specified TCP
1387         connection.  A TCP tickle is a TCP ACK packet with an invalid
1388         sequence and acknowledge number and will when received by the
1389         source host result in it sending an immediate correct ACK back
1390         to the other end.
1391       </para>
1392       <para>
1393         TCP tickles are useful to "tickle" clients after a IP failover has
1394         occured since this will make the client immediately recognize the
1395         TCP connection has been disrupted and that the client will need
1396         to reestablish. This greatly speeds up the time it takes for a client
1397         to detect and reestablish after an IP failover in the ctdb cluster.
1398       </para>
1399     </refsect2>
1400
1401     <refsect2>
1402       <title>version</title>
1403       <para>
1404         Display the CTDB version.
1405       </para>
1406     </refsect2>
1407
1408   </refsect1>
1409
1410   <refsect1>
1411     <title>DEBUGGING COMMANDS</title>
1412     <para>
1413       These commands are primarily used for CTDB development and testing and
1414       should not be used for normal administration.
1415     </para>
1416
1417
1418     <refsect2>
1419       <title>OPTIONS</title>
1420
1421       <variablelist>
1422         <varlistentry><term>--print-emptyrecords</term>
1423         <listitem>
1424           <para>
1425             This enables printing of empty records when dumping databases
1426             with the catdb, cattbd and dumpdbbackup commands. Records with
1427             empty data segment are considered deleted by ctdb and cleaned
1428             by the vacuuming mechanism, so this switch can come in handy for
1429             debugging the vacuuming behaviour.
1430           </para>
1431         </listitem>
1432         </varlistentry>
1433
1434         <varlistentry><term>--print-datasize</term>
1435         <listitem>
1436           <para>
1437             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1438             size of the record data instead of dumping the data contents.
1439           </para>
1440         </listitem>
1441         </varlistentry>
1442
1443         <varlistentry><term>--print-lmaster</term>
1444         <listitem>
1445           <para>
1446             This lets catdb print the lmaster for each record.
1447           </para>
1448         </listitem>
1449         </varlistentry>
1450
1451         <varlistentry><term>--print-hash</term>
1452         <listitem>
1453           <para>
1454             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1455             hash for each record.
1456           </para>
1457         </listitem>
1458         </varlistentry>
1459
1460         <varlistentry><term>--print-recordflags</term>
1461         <listitem>
1462           <para>
1463             This lets catdb and dumpdbbackup print the
1464             record flags for each record. Note that cattdb always
1465             prints the flags.
1466           </para>
1467         </listitem>
1468         </varlistentry>
1469
1470       </variablelist>
1471     </refsect2>
1472
1473     <refsect2>
1474       <title>process-exists <parameter>PID</parameter></title>
1475       <para>
1476         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.
1477       </para>
1478     </refsect2>
1479
1480     <refsect2>
1481       <title>getdbstatus <parameter>DB</parameter></title>
1482       <para>
1483         This command displays more details about a database.
1484       </para>
1485       <refsect3>
1486         <title>Example</title>
1487         <screen>
1488 # ctdb getdbstatus test.tdb.0
1489 dbid: 0x122224da
1490 name: test.tdb
1491 path: /var/ctdb/test.tdb.0
1492 PERSISTENT: no
1493 HEALTH: OK
1494
1495 # ctdb getdbstatus registry.tdb  # with a corrupted TDB
1496 dbid: 0xf2a58948
1497 name: registry.tdb
1498 path: /var/ctdb/persistent/registry.tdb.0
1499 PERSISTENT: yes
1500 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/var/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1501         </screen>
1502       </refsect3>
1503     </refsect2>
1504
1505     <refsect2>
1506       <title>catdb <parameter>DB</parameter></title>
1507       <para>
1508         Print a dump of the clustered TDB database DB.
1509       </para>
1510     </refsect2>
1511
1512     <refsect2>
1513       <title>cattdb <parameter>DB</parameter></title>
1514       <para>
1515         Print a dump of the contents of the local TDB database DB.
1516       </para>
1517     </refsect2>
1518
1519     <refsect2>
1520       <title>dumpdbbackup <parameter>FILE</parameter></title>
1521       <para>
1522         Print a dump of the contents from database backup FILE,
1523         similar to <command>catdb</command>.
1524       </para>
1525     </refsect2>
1526
1527     <refsect2>
1528       <title>wipedb <parameter>DB</parameter></title>
1529       <para>
1530         Remove all contents of database DB.
1531       </para>
1532     </refsect2>
1533
1534     <refsect2>
1535       <title>recover</title>
1536       <para>
1537         This command will trigger the recovery daemon to do a cluster
1538         recovery.
1539       </para>
1540     </refsect2>
1541
1542     <refsect2>
1543       <title>ipreallocate, sync</title>
1544       <para>
1545         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.
1546       </para>
1547     </refsect2>
1548
1549     <refsect2>
1550       <title>getmonmode</title>
1551       <para>
1552         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.
1553       </para>
1554       <para>
1555         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.
1556       </para>
1557       <para>
1558         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.
1559       </para>
1560     </refsect2>
1561
1562
1563     <refsect2>
1564       <title>setmonmode 0|1</title>
1565       <para>
1566         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.
1567       </para>
1568     </refsect2>
1569
1570     <refsect2>
1571       <title>attach <parameter>DBNAME</parameter> [persistent]</title>
1572       <para>
1573         Create a new CTDB database called DBNAME and attach to it on
1574         all nodes.
1575       </para>
1576     </refsect2>
1577
1578     <refsect2>
1579       <title>detach <parameter>DB-LIST</parameter></title>
1580       <para>
1581         Detach specified non-persistent database(s) from the cluster. This
1582         command will disconnect specified database(s) on all nodes in
1583         the cluster.  This command should only be used when none of the
1584         specified database(s) are in use.
1585       </para>
1586       <para>
1587         All nodes should be active and tunable AllowClientDBAccess should
1588         be disabled on all nodes before detaching databases.
1589       </para>
1590     </refsect2>
1591
1592     <refsect2>
1593       <title>dumpmemory</title>
1594       <para>
1595         This is a debugging command. This command will make the ctdb
1596         daemon to write a fill memory allocation map to standard output.
1597       </para>
1598     </refsect2>
1599
1600     <refsect2>
1601       <title>rddumpmemory</title>
1602       <para>
1603         This is a debugging command. This command will dump the talloc memory
1604         allocation tree for the recovery daemon to standard output.
1605       </para>
1606     </refsect2>
1607
1608     <refsect2>
1609       <title>thaw</title>
1610       <para>
1611         Thaw a previously frozen node.
1612       </para>
1613     </refsect2>
1614
1615
1616     <refsect2>
1617       <title>eventscript <parameter>ARGUMENTS</parameter></title>
1618       <para>
1619         This is a debugging command. This command can be used to manually
1620         invoke and run the eventscritps with arbitrary arguments.
1621       </para>
1622     </refsect2>
1623
1624     <refsect2>
1625       <title>ban <parameter>BANTIME</parameter></title>
1626       <para>
1627         Administratively ban a node for BANTIME seconds.  The node
1628         will be unbanned after BANTIME seconds have elapsed.
1629       </para>
1630       <para>
1631         A banned node does not participate in the cluster.  It does
1632         not host any records for the clustered TDB and does not host
1633         any public IP addresses.
1634       </para>
1635       <para>
1636         Nodes are automatically banned if they misbehave.  For
1637         example, a node may be banned if it causes too many cluster
1638         recoveries.
1639       </para>
1640       <para>
1641         To administratively exclude a node from a cluster use the
1642         <command>stop</command> command.
1643       </para>
1644     </refsect2>
1645
1646     <refsect2>
1647       <title>unban</title>
1648       <para>
1649         This command is used to unban a node that has either been
1650         administratively banned using the ban command or has been
1651         automatically banned.
1652       </para>
1653     </refsect2>
1654
1655     <refsect2>
1656       <title>
1657         rebalancenode
1658         <optional><parameter>PNN-LIST</parameter></optional>
1659       </title>
1660       <para>
1661         This command marks the given nodes as rebalance targets in the
1662         LCP2 IP allocation algorithm.  The
1663         <command>reloadips</command> command will do this as necessary
1664         so this command should not be needed.
1665       </para>
1666     </refsect2>
1667
1668     <refsect2>
1669       <title>check_srvids <parameter>SRVID</parameter> ...</title>
1670       <para>
1671         This command checks whether a set of srvid message ports are
1672         registered on the node or not. The command takes a list of
1673         values to check.
1674       </para>
1675       <refsect3>
1676         <title>Example</title>
1677         <screen>
1678 # ctdb check_srvids 1 2 3 14765
1679 Server id 0:1 does not exist
1680 Server id 0:2 does not exist
1681 Server id 0:3 does not exist
1682 Server id 0:14765 exists
1683         </screen>
1684       </refsect3>
1685     </refsect2>
1686
1687   </refsect1>
1688
1689   <!-- UNDOCUMENTED: showban stats disablemonitor enablemonitor
1690        isnotrecmaster addtickle deltickle regsrvid unregsrvid chksrvid
1691        getsrvids rebalanceip setdbprio getdbprio msglisten msgsend
1692        tfetch tstore readkey writekey
1693        checktcpport getdbseqnum ipiface
1694   -->
1695
1696   <refsect1>
1697     <title>SEE ALSO</title>
1698     <para>
1699       <citerefentry><refentrytitle>ctdbd</refentrytitle>
1700       <manvolnum>1</manvolnum></citerefentry>,
1701
1702       <citerefentry><refentrytitle>onnode</refentrytitle>
1703       <manvolnum>1</manvolnum></citerefentry>,
1704
1705       <citerefentry><refentrytitle>ctdb</refentrytitle>
1706       <manvolnum>7</manvolnum></citerefentry>,
1707
1708       <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1709       <manvolnum>7</manvolnum></citerefentry>,
1710
1711       <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1712       <manvolnum>7</manvolnum></citerefentry>,
1713
1714       <ulink url="http://ctdb.samba.org/"/>
1715     </para>
1716   </refsect1>
1717
1718
1719 </refentry>