90e532cb6897b4c3081b1246a62a4dd1ae3fa28b
[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</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>
135
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>
145
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>
154
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>
168
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>
178
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>
189
190       <varlistentry><term>-? --help</term>
191       <listitem>
192         <para>
193           Print some help text to the screen.
194         </para>
195       </listitem>
196       </varlistentry>
197
198       <varlistentry><term>--usage</term>
199       <listitem>
200         <para>
201           Print useage information to the screen.
202         </para>
203       </listitem>
204       </varlistentry>
205
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>
215
216
217   <refsect1>
218     <title>ADMINISTRATIVE COMMANDS</title>
219     <para>
220       These are commands used to monitor and administer a CTDB cluster.
221     </para>
222
223     <refsect2>
224       <title>pnn</title>
225       <para>
226         This command displays the PNN of the current node.
227       </para>
228     </refsect2>
229
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>
236
237       <para>
238         Note: If the the queried node is INACTIVE then the status
239         might not be current.
240       </para>
241
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>
251
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>
279
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>
289
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 recovery master 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 recovery master 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>Recovery master</title>
320         <para>
321           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.
322         </para>
323         <para>
324           Only one node at a time can be the designated recovery master. Which
325           node is designated the recovery master is decided by an election
326           process in the recovery daemons running on each node.
327         </para>
328       </refsect3>
329
330       <refsect3>
331         <title>Example</title>
332         <screen>
333 # ctdb status
334 Number of nodes:4
335 pnn:0 192.168.2.200       OK (THIS NODE)
336 pnn:1 192.168.2.201       OK
337 pnn:2 192.168.2.202       OK
338 pnn:3 192.168.2.203       OK
339 Generation:1362079228
340 Size:4
341 hash:0 lmaster:0
342 hash:1 lmaster:1
343 hash:2 lmaster:2
344 hash:3 lmaster:3
345 Recovery mode:NORMAL (0)
346 Recovery master:0
347         </screen>
348       </refsect3>
349     </refsect2>
350
351     <refsect2>
352       <title>nodestatus <optional><parameter>PNN-LIST</parameter></optional></title>
353       <para>
354         This command is similar to the <command>status</command>
355         command.  It displays the "node status" subset of output.  The
356         main differences are:
357       </para>
358
359       <itemizedlist>
360         <listitem>
361           <para>
362             The exit code is the bitwise-OR of the flags for each
363             specified node, while <command>ctdb status</command> exits
364             with 0 if it was able to retrieve status for all nodes.
365           </para>
366         </listitem>
367
368         <listitem>
369           <para>
370             <command>ctdb status</command> provides status information
371             for all nodes.  <command>ctdb nodestatus</command>
372             defaults to providing status for only the current node.
373             If PNN-LIST is provided then status is given for
374             the indicated node(s).
375           </para>
376         </listitem>
377       </itemizedlist>
378
379       <para>
380         A common invocation in scripts is <command>ctdb nodestatus
381         all</command> to check whether all nodes in a cluster are
382         healthy.
383       </para>
384
385       <refsect3>
386         <title>Example</title>
387         <screen>
388 # ctdb nodestatus
389 pnn:0 10.0.0.30        OK (THIS NODE)
390
391 # ctdb nodestatus all
392 Number of nodes:2
393 pnn:0 10.0.0.30        OK (THIS NODE)
394 pnn:1 10.0.0.31        OK
395         </screen>
396       </refsect3>
397     </refsect2>
398
399     <refsect2>
400       <title>recmaster</title>
401       <para>
402         This command shows the pnn of the node which is currently the recmaster.
403       </para>
404
405       <para>
406         Note: If the the queried node is INACTIVE then the status
407         might not be current.
408       </para>
409     </refsect2>
410
411     <refsect2>
412       <title>uptime</title>
413       <para>
414         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.
415       </para>
416
417       <refsect3>
418         <title>Example</title>
419         <screen>
420 # ctdb uptime
421 Current time of node          :                Thu Oct 29 10:38:54 2009
422 Ctdbd start time              : (000 16:54:28) Wed Oct 28 17:44:26 2009
423 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
424 Duration of last recovery/failover: 2.248552 seconds
425         </screen>
426       </refsect3>
427     </refsect2>
428
429     <refsect2>
430       <title>listnodes</title>
431       <para>
432         This command shows lists the ip addresses of all the nodes in the cluster.
433       </para>
434
435       <refsect3>
436         <title>Example</title>
437         <screen>
438 # ctdb listnodes
439 192.168.2.200
440 192.168.2.201
441 192.168.2.202
442 192.168.2.203
443         </screen>
444       </refsect3>
445     </refsect2>
446
447     <refsect2>
448       <title>natgw {master|list|status}</title>
449       <para>
450         This command shows different aspects of NAT gateway status.
451         For an overview of CTDB's NAT gateway functionality please see
452         the <citetitle>NAT GATEWAY</citetitle> section in
453         <citerefentry><refentrytitle>ctdb</refentrytitle>
454         <manvolnum>7</manvolnum></citerefentry>.
455       </para>
456
457       <variablelist>
458         <varlistentry>
459           <term>master</term>
460           <listitem>
461             <para>
462               Show the PNN and private IP address of the current NAT
463               gateway master node.
464             </para>
465             <para>
466               Example output:
467             </para>
468             <screen>
469 1 192.168.2.201
470             </screen>
471           </listitem>
472         </varlistentry>
473         <varlistentry>
474           <term>list</term>
475           <listitem>
476             <para>
477               List the private IP addresses of nodes in the current
478               NAT gateway group, annotating the master node.
479             </para>
480             <para>
481               Example output:
482             </para>
483             <screen>
484 192.168.2.200
485 192.168.2.201   MASTER
486 192.168.2.202
487 192.168.2.203
488             </screen>
489           </listitem>
490         </varlistentry>
491         <varlistentry>
492           <term>status</term>
493           <listitem>
494             <para>
495               List the nodes in the current NAT gateway group and
496               their status.
497             </para>
498             <para>
499               Example output:
500             </para>
501             <screen>
502 pnn:0 192.168.2.200       UNHEALTHY (THIS NODE)
503 pnn:1 192.168.2.201       OK
504 pnn:2 192.168.2.202       OK
505 pnn:3 192.168.2.203       OK
506             </screen>
507           </listitem>
508         </varlistentry>
509       </variablelist>
510     </refsect2>
511
512     <refsect2>
513       <title>ping</title>
514       <para>
515         This command will "ping" specified CTDB nodes in the cluster
516         to verify that they are running.
517       </para>
518       <refsect3>
519         <title>Example</title>
520         <screen>
521 # ctdb ping
522 response from 0 time=0.000054 sec  (3 clients)
523         </screen>
524       </refsect3>
525     </refsect2>
526
527     <refsect2>
528       <title>ifaces</title>
529       <para>
530         This command will display the list of network interfaces, which could
531         host public addresses, along with their status.
532       </para>
533       <refsect3>
534         <title>Example</title>
535         <screen>
536 # ctdb ifaces
537 Interfaces on node 0
538 name:eth5 link:up references:2
539 name:eth4 link:down references:0
540 name:eth3 link:up references:1
541 name:eth2 link:up references:1
542
543 # ctdb -X ifaces
544 |Name|LinkStatus|References|
545 |eth5|1|2|
546 |eth4|0|0|
547 |eth3|1|1|
548 |eth2|1|1|
549         </screen>
550       </refsect3>
551     </refsect2>
552
553     <refsect2>
554       <title>ip</title>
555       <para>
556         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".
557       </para>
558       <refsect3>
559         <title>Example</title>
560         <screen>
561 # ctdb ip -v
562 Public IPs on node 0
563 172.31.91.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
564 172.31.91.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
565 172.31.91.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
566 172.31.91.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
567 172.31.92.82 node[1] active[] available[eth5] configured[eth4,eth5]
568 172.31.92.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
569 172.31.92.84 node[1] active[] available[eth5] configured[eth4,eth5]
570 172.31.92.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
571
572 # ctdb -X ip -v
573 |Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|
574 |172.31.91.82|1||eth2,eth3|eth2,eth3|
575 |172.31.91.83|0|eth3|eth2,eth3|eth2,eth3|
576 |172.31.91.84|1||eth2,eth3|eth2,eth3|
577 |172.31.91.85|0|eth2|eth2,eth3|eth2,eth3|
578 |172.31.92.82|1||eth5|eth4,eth5|
579 |172.31.92.83|0|eth5|eth5|eth4,eth5|
580 |172.31.92.84|1||eth5|eth4,eth5|
581 |172.31.92.85|0|eth5|eth5|eth4,eth5|
582         </screen>
583       </refsect3>
584     </refsect2>
585
586     <refsect2>
587       <title>ipinfo <parameter>IP</parameter></title>
588       <para>
589         This command will display details about the specified public addresses.
590       </para>
591       <refsect3>
592         <title>Example</title>
593         <screen>
594 # ctdb ipinfo 172.31.92.85
595 Public IP[172.31.92.85] info on node 0
596 IP:172.31.92.85
597 CurrentNode:0
598 NumInterfaces:2
599 Interface[1]: Name:eth4 Link:down References:0
600 Interface[2]: Name:eth5 Link:up References:2 (active)
601         </screen>
602       </refsect3>
603     </refsect2>
604
605     <refsect2>
606       <title>event run|status|script list|script enable|script disable</title>
607       <para>
608         This command is used to control event daemon and to inspect
609         status of various events.
610       </para>
611
612       <variablelist>
613         <varlistentry>
614           <term>run <parameter>EVENT</parameter> <parameter>TIMEOUT</parameter> <optional><parameter>ARGUMENTS</parameter></optional> </term>
615           <listitem>
616             <para>
617              This command can be used to manually run specified EVENT
618              with optional ARGUMENTS.  The event will be allowed to run
619              a maximum of TIMEOUT seconds.  If TIMEOUT is 0, then there
620              is no time limit for running the event.
621             </para>
622           </listitem>
623         </varlistentry>
624
625         <varlistentry>
626           <term>status <optional><parameter>EVENT</parameter></optional> <optional>lastrun|lastpass|lastfail</optional></term>
627           <listitem>
628             <para>
629               This command displays the last execution status of the
630               specified EVENT.  If no event is specified, then the status
631               of last executed monitor event will be displayed.
632             </para>
633             <para>
634               To see the last successful execution of the event, lastpass
635               can be specified. Similarly lastfail can be specified
636               to see the last unsuccessful execution of the event.
637               The optional lastrun can be specified to query the last
638               execution of the event.
639             </para>
640             <para>
641               The command will terminate with the exit status
642               corresponding to the overall status of event that is
643               displayed.  If lastpass is specified, then the command will
644               always terminate with 0.  If lastfail is specified then the
645               command will always terminate with non-zero exit status.
646               If lastrun is specified, then the command will terminate
647               with 0 or not depending on if the last execution of the
648               event was successful or not.
649             </para>
650             <para>
651               The output is the list of event scripts executed.
652               Each line shows the name, status, duration and start time
653               for each script.
654             </para>
655             <para>
656               Example output:
657             </para>
658             <screen>
659 00.ctdb              OK         0.014 Sat Dec 17 19:39:11 2016
660 01.reclock           OK         0.013 Sat Dec 17 19:39:11 2016
661 05.system            OK         0.029 Sat Dec 17 19:39:11 2016
662 06.nfs               OK         0.014 Sat Dec 17 19:39:11 2016
663 10.interface         OK         0.037 Sat Dec 17 19:39:11 2016
664 11.natgw             OK         0.011 Sat Dec 17 19:39:11 2016
665 11.routing           OK         0.007 Sat Dec 17 19:39:11 2016
666 13.per_ip_routing    OK         0.007 Sat Dec 17 19:39:11 2016
667 20.multipathd        OK         0.007 Sat Dec 17 19:39:11 2016
668 31.clamd             OK         0.007 Sat Dec 17 19:39:11 2016
669 40.vsftpd            OK         0.013 Sat Dec 17 19:39:11 2016
670 41.httpd             OK         0.018 Sat Dec 17 19:39:11 2016
671 49.winbind           OK         0.023 Sat Dec 17 19:39:11 2016
672 50.samba             OK         0.100 Sat Dec 17 19:39:12 2016
673 60.nfs               OK         0.376 Sat Dec 17 19:39:12 2016
674 70.iscsi             OK         0.009 Sat Dec 17 19:39:12 2016
675 91.lvs               OK         0.007 Sat Dec 17 19:39:12 2016
676 99.timeout           OK         0.007 Sat Dec 17 19:39:12 2016
677             </screen>
678           </listitem>
679         </varlistentry>
680
681         <varlistentry>
682           <term>script list</term>
683           <listitem>
684             <para>
685               List the available event scripts.
686             </para>
687             <para>
688               Example output:
689             </para>
690             <screen>
691 00.ctdb             
692 01.reclock          
693 05.system           
694 06.nfs              
695 10.interface        
696 11.natgw            
697 11.routing          
698 13.per_ip_routing   
699 20.multipathd       
700 31.clamd            
701 40.vsftpd           
702 41.httpd            
703 49.winbind          
704 50.samba            
705 60.nfs              
706 70.iscsi            
707 91.lvs              
708 99.timeout          
709             </screen>
710           </listitem>
711         </varlistentry>
712
713         <varlistentry>
714           <term>script enable <parameter>SCRIPT</parameter></term>
715           <listitem>
716             <para>
717               Enable the specified event SCRIPT.  Only enabled scripts will be
718               executed when running any event.
719             </para>
720           </listitem>
721         </varlistentry>
722
723         <varlistentry>
724           <term>script disable <parameter>SCRIPT</parameter></term>
725           <listitem>
726             <para>
727               Disable the specified event SCRIPT.  This will prevent the script
728               from executing when running any event.
729             </para>
730           </listitem>
731         </varlistentry>
732       </variablelist>
733     </refsect2>
734
735     <refsect2>
736       <title>scriptstatus</title>
737       <para>
738         This command displays which event scripts where run in the previous
739         monitoring cycle and the result of each script. If a script
740         failed with an error, causing the node to become unhealthy,
741         the output from that script is also shown.
742       </para>
743       <para>
744         This command is deprecated.  It's provided for backward
745         compatibility.  In place of <command>ctdb scriptstatus</command>,
746         use <command>ctdb event status</command>.
747       </para>
748       <refsect3>
749         <title>Example</title>
750         <screen>
751 # ctdb scriptstatus
752 00.ctdb              OK         0.011 Sat Dec 17 19:40:46 2016
753 01.reclock           OK         0.010 Sat Dec 17 19:40:46 2016
754 05.system            OK         0.030 Sat Dec 17 19:40:46 2016
755 06.nfs               OK         0.014 Sat Dec 17 19:40:46 2016
756 10.interface         OK         0.041 Sat Dec 17 19:40:46 2016
757 11.natgw             OK         0.008 Sat Dec 17 19:40:46 2016
758 11.routing           OK         0.007 Sat Dec 17 19:40:46 2016
759 13.per_ip_routing    OK         0.007 Sat Dec 17 19:40:46 2016
760 20.multipathd        OK         0.007 Sat Dec 17 19:40:46 2016
761 31.clamd             OK         0.007 Sat Dec 17 19:40:46 2016
762 40.vsftpd            OK         0.013 Sat Dec 17 19:40:46 2016
763 41.httpd             OK         0.015 Sat Dec 17 19:40:46 2016
764 49.winbind           OK         0.022 Sat Dec 17 19:40:46 2016
765 50.samba             ERROR      0.077 Sat Dec 17 19:40:46 2016
766   OUTPUT: ERROR: samba tcp port 445 is not responding
767       </screen>
768       </refsect3>
769     </refsect2>
770
771     <refsect2>
772       <title>listvars</title>
773       <para>
774         List all tuneable variables, except the values of the obsolete tunables
775         like VacuumMinInterval. The obsolete tunables can be retrieved only
776         explicitly with the "ctdb getvar" command.
777       </para>
778       <refsect3>
779         <title>Example</title>
780         <screen>
781 # ctdb listvars
782 SeqnumInterval          = 1000
783 ControlTimeout          = 60
784 TraverseTimeout         = 20
785 KeepaliveInterval       = 5
786 KeepaliveLimit          = 5
787 RecoverTimeout          = 120
788 RecoverInterval         = 1
789 ElectionTimeout         = 3
790 TakeoverTimeout         = 9
791 MonitorInterval         = 15
792 TickleUpdateInterval    = 20
793 EventScriptTimeout      = 30
794 MonitorTimeoutCount     = 20
795 RecoveryGracePeriod     = 120
796 RecoveryBanPeriod       = 300
797 DatabaseHashSize        = 100001
798 DatabaseMaxDead         = 5
799 RerecoveryTimeout       = 10
800 EnableBans              = 1
801 NoIPFailback            = 0
802 DisableIPFailover       = 0
803 VerboseMemoryNames      = 0
804 RecdPingTimeout         = 60
805 RecdFailCount           = 10
806 LogLatencyMs            = 0
807 RecLockLatencyMs        = 1000
808 RecoveryDropAllIPs      = 120
809 VacuumInterval          = 10
810 VacuumMaxRunTime        = 120
811 RepackLimit             = 10000
812 VacuumLimit             = 5000
813 VacuumFastPathCount     = 60
814 MaxQueueDropMsg         = 1000000
815 AllowUnhealthyDBRead    = 0
816 StatHistoryInterval     = 1
817 DeferredAttachTO        = 120
818 AllowClientDBAttach     = 1
819 RecoverPDBBySeqNum      = 1
820 DeferredRebalanceOnNodeAdd = 300
821 FetchCollapse           = 1
822 HopcountMakeSticky      = 50
823 StickyDuration          = 600
824 StickyPindown           = 200
825 NoIPTakeover            = 0
826 DBRecordCountWarn       = 100000
827 DBRecordSizeWarn        = 10000000
828 DBSizeWarn              = 100000000
829 PullDBPreallocation     = 10485760
830 TDBMutexEnabled         = 1
831 LockProcessesPerDB      = 200
832 RecBufferSizeLimit      = 1000000
833 QueueBufferSize         = 1024
834 IPAllocAlgorithm        = 2
835         </screen>
836       </refsect3>
837     </refsect2>
838
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>
852
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>
865
866     <refsect2>
867       <title>lvs {master|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>
875
876       <variablelist>
877         <varlistentry>
878           <term>master</term>
879           <listitem>
880             <para>
881               Shows the PNN of the current LVS master node.
882             </para>
883       <para>
884         Example output:
885       </para>
886       <screen>
887 2
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>
924
925     </refsect2>
926
927
928     <refsect2>
929       <title>getcapabilities</title>
930
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>
937
938       <para>
939         Example output:
940       </para>
941       <screen>
942 RECMASTER: YES
943 LMASTER: YES
944       </screen>
945
946     </refsect2>
947
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>
1014
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>
1024
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>
1054
1055     <refsect2>
1056       <title>getreclock</title>
1057       <para>
1058         Show details of the recovery lock, if any.
1059       </para>
1060
1061       <para>
1062         Example output:
1063       </para>
1064       <screen>
1065         /clusterfs/.ctdb/recovery.lock
1066       </screen>
1067
1068     </refsect2>
1069
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>
1087
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>
1097
1098     <refsect2>
1099       <title>getpid</title>
1100       <para>
1101         This command will return the process id of the ctdb daemon.
1102       </para>
1103     </refsect2>
1104
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>
1114
1115     <refsect2>
1116       <title>enable</title>
1117       <para>
1118         Re-enable a node that has been administratively disabled.
1119       </para>
1120     </refsect2>
1121
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 addresse, 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>
1133
1134     <refsect2>
1135       <title>continue</title>
1136       <para>
1137         Re-start a node that has been administratively stopped.
1138       </para>
1139     </refsect2>
1140
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>
1156
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>
1175
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>
1194
1195     <refsect2>
1196       <title>shutdown</title>
1197       <para>
1198         This command will shutdown a specific CTDB daemon.
1199       </para>
1200     </refsect2>
1201
1202     <refsect2>
1203       <title>setlmasterrole on|off</title>
1204       <para>
1205         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.
1206       </para>
1207
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>
1218
1219     <refsect2>
1220       <title>setrecmasterrole on|off</title>
1221       <para>
1222         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.
1223       </para>
1224
1225       <para>
1226         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.
1227       </para>
1228       <para>
1229         See also "ctdb getcapabilities"
1230       </para>
1231     </refsect2>
1232
1233     <refsect2>
1234       <title>reloadnodes</title>
1235       <para>
1236         This command is used when adding new nodes, or removing
1237         existing nodes from an existing cluster.
1238       </para>
1239       <para>
1240         Procedure to add nodes:
1241       </para>
1242       <orderedlist>
1243         <listitem>
1244           <para>
1245              To expand an existing cluster, first ensure with
1246              <command>ctdb status</command> that all nodes are up and
1247              running and that they are all healthy.  Do not try to
1248              expand a cluster unless it is completely healthy!
1249           </para>
1250         </listitem>
1251         <listitem>
1252           <para>
1253             On all nodes, edit <filename>/usr/local/etc/ctdb/nodes</filename>
1254             and <emphasis>add the new nodes at the end of this
1255             file</emphasis>.
1256           </para>
1257         </listitem>
1258         <listitem>
1259           <para>
1260             Verify that all the nodes have identical
1261             <filename>/usr/local/etc/ctdb/nodes</filename> files after adding
1262             the new nodes.
1263           </para>
1264         </listitem>
1265         <listitem>
1266           <para>
1267             Run <command>ctdb reloadnodes</command> to force all nodes
1268             to reload the nodes file.
1269           </para>
1270         </listitem>
1271         <listitem>
1272           <para>
1273             Use <command>ctdb status</command> on all nodes and verify
1274             that they now show the additional nodes.
1275           </para>
1276         </listitem>
1277         <listitem>
1278           <para>
1279             Install and configure the new node and bring it online.
1280           </para>
1281         </listitem>
1282       </orderedlist>
1283       <para>
1284         Procedure to remove nodes:
1285       </para>
1286       <orderedlist>
1287         <listitem>
1288           <para>
1289             To remove nodes from an existing cluster, first ensure
1290             with <command>ctdb status</command> that all nodes, except
1291             the node to be deleted, are up and running and that they
1292             are all healthy.  Do not try to remove nodes from a
1293             cluster unless the cluster is completely healthy!
1294           </para>
1295         </listitem>
1296         <listitem>
1297           <para>
1298             Shutdown and power off the node to be removed.
1299           </para>
1300         </listitem>
1301         <listitem>
1302           <para>
1303             On all other nodes, edit the
1304             <filename>/usr/local/etc/ctdb/nodes</filename> file and
1305             <emphasis>comment out</emphasis> the nodes to be removed.
1306             <emphasis>Do not delete the lines for the deleted
1307             nodes</emphasis>, just comment them out by adding a '#' at
1308             the beginning of the lines.
1309           </para>
1310         </listitem>
1311         <listitem>
1312           <para>
1313             Run <command>ctdb reloadnodes</command> to force all nodes
1314             to reload the nodes file.
1315           </para>
1316         </listitem>
1317         <listitem>
1318           <para>
1319             Use <command>ctdb status</command> on all nodes and verify
1320             that the deleted nodes are no longer listed.
1321           </para>
1322         </listitem>
1323       </orderedlist>
1324
1325     </refsect2>
1326
1327     <refsect2>
1328       <title>
1329         reloadips
1330         <optional><parameter>PNN-LIST</parameter></optional>
1331       </title>
1332       <para>
1333         This command reloads the public addresses configuration file
1334         on the specified nodes.  When it completes addresses will be
1335         reconfigured and reassigned across the cluster as necessary.
1336       </para>
1337
1338       <para>
1339         This command is currently unable to make changes to the
1340         netmask or interfaces associated with existing addresses.
1341         Such changes must be made in 2 steps by deleting addresses in
1342         question and re-adding then.  Unfortunately this will disrupt
1343         connections to the changed addresses.
1344       </para>
1345     </refsect2>
1346
1347     <refsect2>
1348       <title>getdbmap</title>
1349       <para>
1350         This command lists all clustered TDB databases that the CTDB
1351         daemon has attached to. Some databases are flagged as PERSISTENT,
1352         this means that the database stores data persistently and the
1353         data will remain across reboots. One example of such a database
1354         is secrets.tdb where information about how the cluster was joined
1355         to the domain is stored.  Some database are flagged as REPLICATED,
1356         this means that the data in that database is replicated across all
1357         the nodes.  But the data will not remain across reboots.  This
1358         type of database is used by CTDB to store it's internal state.
1359       </para>
1360       <para>
1361         If a PERSISTENT database is not in a healthy state the database
1362         is flagged as UNHEALTHY. If there's at least one completely
1363         healthy node running in the cluster, it's possible that the
1364         content is restored by a recovery run automaticly. Otherwise an
1365         administrator needs to analyze the problem.
1366       </para>
1367       <para>
1368         See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1369         "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1370         and (if samba or tdb-utils are installed) "tdbtool check".
1371       </para>
1372       <para>
1373         Most databases are not persistent and only store the state
1374         information that the currently running samba daemons need. These
1375         databases are always wiped when ctdb/samba starts and when a
1376         node is rebooted.
1377       </para>
1378
1379       <refsect3>
1380         <title>Example</title>
1381         <screen>
1382 # ctdb getdbmap
1383 Number of databases:10
1384 dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
1385 dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
1386 dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
1387 dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
1388 dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
1389 dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
1390 dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1391 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
1392 dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1393 dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
1394
1395 # ctdb getdbmap  # example for unhealthy database
1396 Number of databases:1
1397 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1398
1399 # ctdb -X getdbmap
1400 |ID|Name|Path|Persistent|Unhealthy|
1401 |0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
1402         </screen>
1403       </refsect3>
1404     </refsect2>
1405
1406     <refsect2>
1407       <title>
1408         backupdb
1409         <parameter>DB</parameter>
1410         <parameter>FILE</parameter>
1411       </title>
1412       <para>
1413         Copy the contents of database DB to FILE.  FILE can later be
1414         read back using <command>restoredb</command>.  This is mainly
1415         useful for backing up persistent databases such as
1416         <filename>secrets.tdb</filename> and similar.
1417       </para>
1418     </refsect2>
1419
1420     <refsect2>
1421       <title>
1422         restoredb
1423         <parameter>FILE</parameter>
1424         <optional><parameter>DB</parameter></optional>
1425       </title>
1426       <para>
1427         This command restores a persistent database that was
1428         previously backed up using backupdb.  By default the data will
1429         be restored back into the same database as it was created
1430         from. By specifying dbname you can restore the data into a
1431         different database.
1432       </para>
1433     </refsect2>
1434
1435     <refsect2>
1436       <title>setdbreadonly <parameter>DB</parameter></title>
1437       <para>
1438         This command will enable the read-only record support for a
1439         database.  This is an experimental feature to improve
1440         performance for contended records primarily in locking.tdb and
1441         brlock.tdb.  When enabling this feature you must set it on all
1442         nodes in the cluster.
1443       </para>
1444     </refsect2>
1445
1446     <refsect2>
1447       <title>setdbsticky <parameter>DB</parameter></title>
1448       <para>
1449         This command will enable the sticky record support for the
1450         specified database.  This is an experimental feature to
1451         improve performance for contended records primarily in
1452         locking.tdb and brlock.tdb.  When enabling this feature you
1453         must set it on all nodes in the cluster.
1454       </para>
1455     </refsect2>
1456
1457   </refsect1>
1458
1459   <refsect1>
1460     <title>INTERNAL COMMANDS</title>
1461
1462     <para>
1463       Internal commands are used by CTDB's scripts and are not
1464       required for managing a CTDB cluster.  Their parameters and
1465       behaviour are subject to change.
1466     </para>
1467
1468     <refsect2>
1469       <title>gettickles <parameter>IPADDR</parameter></title>
1470       <para>
1471         Show TCP connections that are registered with CTDB to be
1472         "tickled" if there is a failover.
1473       </para>
1474     </refsect2>
1475
1476     <refsect2>
1477       <title>gratarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1478       <para>
1479         Send out a gratuitous ARP for the specified interface through
1480         the specified interface. This command is mainly used by the
1481         ctdb eventscripts.
1482       </para>
1483     </refsect2>
1484
1485     <refsect2>
1486       <title>
1487         pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1488       </title>
1489       <para>
1490         Delete KEY from DB.
1491       </para>
1492     </refsect2>
1493
1494     <refsect2>
1495       <title>
1496         pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1497       </title>
1498       <para>
1499         Print the value associated with KEY in DB.
1500       </para>
1501     </refsect2>
1502
1503     <refsect2>
1504       <title>
1505         pstore
1506         <parameter>DB</parameter>
1507         <parameter>KEY</parameter>
1508         <parameter>FILE</parameter>
1509       </title>
1510       <para>
1511         Store KEY in DB with contents of FILE as the associated value.
1512       </para>
1513     </refsect2>
1514
1515     <refsect2>
1516       <title>
1517         ptrans
1518         <parameter>DB</parameter>
1519         <optional><parameter>FILE</parameter></optional>
1520       </title>
1521       <para>
1522         Read a list of key-value pairs, one per line from FILE, and
1523         store them in DB using a single transaction.  An empty value
1524         is equivalent to deleting the given key.
1525       </para>
1526       <para>
1527         The key and value should be separated by spaces or tabs. Each
1528         key/value should be a printable string enclosed in
1529         double-quotes.
1530       </para>
1531     </refsect2>
1532
1533     <refsect2>
1534       <title>runstate [setup|first_recovery|startup|running]</title>
1535       <para>
1536         Print the runstate of the specified node.  Runstates are used
1537         to serialise important state transitions in CTDB, particularly
1538         during startup.
1539       </para>
1540       <para>
1541         If one or more optional runstate arguments are specified then
1542         the node must be in one of these runstates for the command to
1543         succeed.
1544       </para>
1545       <refsect3>
1546         <title>Example</title>
1547         <screen>
1548 # ctdb runstate
1549 RUNNING
1550         </screen>
1551       </refsect3>
1552     </refsect2>
1553
1554     <refsect2>
1555       <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1556       <para>
1557         Set the internal state of network interface IFACE.  This is
1558         typically used in the <filename>10.interface</filename> script
1559         in the "monitor" event.
1560       </para>
1561       <para>
1562         Example: ctdb setifacelink eth0 up
1563       </para>
1564     </refsect2>
1565
1566     <refsect2>
1567       <title>tickle</title>
1568       <para>
1569         Read a list of TCP connections, one per line, from standard
1570         input and send a TCP tickle to the source host for each
1571         connection.  A connection is specified as:
1572       </para>
1573       <synopsis>
1574         <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1575       </synopsis>
1576       <para>
1577         A single connection can be specified on the command-line
1578         rather than on standard input.
1579       </para>
1580       <para>
1581         A TCP tickle is a TCP ACK packet with an invalid sequence and
1582         acknowledge number and will when received by the source host
1583         result in it sending an immediate correct ACK back to the
1584         other end.
1585       </para>
1586       <para>
1587         TCP tickles are useful to "tickle" clients after a IP failover has
1588         occurred since this will make the client immediately recognize the
1589         TCP connection has been disrupted and that the client will need
1590         to reestablish. This greatly speeds up the time it takes for a client
1591         to detect and reestablish after an IP failover in the ctdb cluster.
1592       </para>
1593     </refsect2>
1594
1595     <refsect2>
1596       <title>version</title>
1597       <para>
1598         Display the CTDB version.
1599       </para>
1600     </refsect2>
1601
1602   </refsect1>
1603
1604   <refsect1>
1605     <title>DEBUGGING COMMANDS</title>
1606     <para>
1607       These commands are primarily used for CTDB development and testing and
1608       should not be used for normal administration.
1609     </para>
1610
1611
1612     <refsect2>
1613       <title>OPTIONS</title>
1614
1615       <variablelist>
1616         <varlistentry><term>--print-emptyrecords</term>
1617         <listitem>
1618           <para>
1619             This enables printing of empty records when dumping databases
1620             with the catdb, cattbd and dumpdbbackup commands. Records with
1621             empty data segment are considered deleted by ctdb and cleaned
1622             by the vacuuming mechanism, so this switch can come in handy for
1623             debugging the vacuuming behaviour.
1624           </para>
1625         </listitem>
1626         </varlistentry>
1627
1628         <varlistentry><term>--print-datasize</term>
1629         <listitem>
1630           <para>
1631             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1632             size of the record data instead of dumping the data contents.
1633           </para>
1634         </listitem>
1635         </varlistentry>
1636
1637         <varlistentry><term>--print-lmaster</term>
1638         <listitem>
1639           <para>
1640             This lets catdb print the lmaster for each record.
1641           </para>
1642         </listitem>
1643         </varlistentry>
1644
1645         <varlistentry><term>--print-hash</term>
1646         <listitem>
1647           <para>
1648             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1649             hash for each record.
1650           </para>
1651         </listitem>
1652         </varlistentry>
1653
1654         <varlistentry><term>--print-recordflags</term>
1655         <listitem>
1656           <para>
1657             This lets catdb and dumpdbbackup print the
1658             record flags for each record. Note that cattdb always
1659             prints the flags.
1660           </para>
1661         </listitem>
1662         </varlistentry>
1663
1664       </variablelist>
1665     </refsect2>
1666
1667     <refsect2>
1668       <title>process-exists <parameter>PID</parameter> <parameter>[SRVID]</parameter></title>
1669       <para>
1670         This command checks if a specific process exists on the CTDB
1671         host. This is mainly used by Samba to check if remote instances
1672         of samba are still running or not.  When the optional SRVID
1673         argument is specified, the command check if a specific process
1674         exists on the CTDB host and has registered for specified SRVID.
1675       </para>
1676     </refsect2>
1677
1678     <refsect2>
1679       <title>getdbstatus <parameter>DB</parameter></title>
1680       <para>
1681         This command displays more details about a database.
1682       </para>
1683       <refsect3>
1684         <title>Example</title>
1685         <screen>
1686 # ctdb getdbstatus test.tdb.0
1687 dbid: 0x122224da
1688 name: test.tdb
1689 path: /usr/local/var/lib/ctdb/test.tdb.0
1690 PERSISTENT: no
1691 HEALTH: OK
1692
1693 # ctdb getdbstatus registry.tdb  # with a corrupted TDB
1694 dbid: 0xf2a58948
1695 name: registry.tdb
1696 path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
1697 PERSISTENT: yes
1698 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1699         </screen>
1700       </refsect3>
1701     </refsect2>
1702
1703     <refsect2>
1704       <title>catdb <parameter>DB</parameter></title>
1705       <para>
1706         Print a dump of the clustered TDB database DB.
1707       </para>
1708     </refsect2>
1709
1710     <refsect2>
1711       <title>cattdb <parameter>DB</parameter></title>
1712       <para>
1713         Print a dump of the contents of the local TDB database DB.
1714       </para>
1715     </refsect2>
1716
1717     <refsect2>
1718       <title>dumpdbbackup <parameter>FILE</parameter></title>
1719       <para>
1720         Print a dump of the contents from database backup FILE,
1721         similar to <command>catdb</command>.
1722       </para>
1723     </refsect2>
1724
1725     <refsect2>
1726       <title>wipedb <parameter>DB</parameter></title>
1727       <para>
1728         Remove all contents of database DB.
1729       </para>
1730     </refsect2>
1731
1732     <refsect2>
1733       <title>recover</title>
1734       <para>
1735         This command will trigger the recovery daemon to do a cluster
1736         recovery.
1737       </para>
1738     </refsect2>
1739
1740     <refsect2>
1741       <title>ipreallocate, sync</title>
1742       <para>
1743         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.
1744       </para>
1745     </refsect2>
1746
1747     <refsect2>
1748       <title>attach <parameter>DBNAME</parameter> [persistent|replicated]</title>
1749       <para>
1750         Create a new CTDB database called DBNAME and attach to it on
1751         all nodes.
1752       </para>
1753     </refsect2>
1754
1755     <refsect2>
1756       <title>detach <parameter>DB-LIST</parameter></title>
1757       <para>
1758         Detach specified non-persistent database(s) from the cluster. This
1759         command will disconnect specified database(s) on all nodes in
1760         the cluster.  This command should only be used when none of the
1761         specified database(s) are in use.
1762       </para>
1763       <para>
1764         All nodes should be active and tunable AllowClientDBAccess should
1765         be disabled on all nodes before detaching databases.
1766       </para>
1767     </refsect2>
1768
1769     <refsect2>
1770       <title>dumpmemory</title>
1771       <para>
1772         This is a debugging command. This command will make the ctdb
1773         daemon to write a fill memory allocation map to standard output.
1774       </para>
1775     </refsect2>
1776
1777     <refsect2>
1778       <title>rddumpmemory</title>
1779       <para>
1780         This is a debugging command. This command will dump the talloc memory
1781         allocation tree for the recovery daemon to standard output.
1782       </para>
1783     </refsect2>
1784
1785     <refsect2>
1786       <title>ban <parameter>BANTIME</parameter></title>
1787       <para>
1788         Administratively ban a node for BANTIME seconds.  The node
1789         will be unbanned after BANTIME seconds have elapsed.
1790       </para>
1791       <para>
1792         A banned node does not participate in the cluster.  It does
1793         not host any records for the clustered TDB and does not host
1794         any public IP addresses.
1795       </para>
1796       <para>
1797         Nodes are automatically banned if they misbehave.  For
1798         example, a node may be banned if it causes too many cluster
1799         recoveries.
1800       </para>
1801       <para>
1802         To administratively exclude a node from a cluster use the
1803         <command>stop</command> command.
1804       </para>
1805     </refsect2>
1806
1807     <refsect2>
1808       <title>unban</title>
1809       <para>
1810         This command is used to unban a node that has either been
1811         administratively banned using the ban command or has been
1812         automatically banned.
1813       </para>
1814     </refsect2>
1815
1816   </refsect1>
1817
1818   <!-- UNDOCUMENTED: stats
1819        isnotrecmaster addtickle deltickle
1820        tfetch tstore readkey writekey
1821        checktcpport getdbseqnum
1822   -->
1823
1824   <refsect1>
1825     <title>SEE ALSO</title>
1826     <para>
1827       <citerefentry><refentrytitle>ctdbd</refentrytitle>
1828       <manvolnum>1</manvolnum></citerefentry>,
1829
1830       <citerefentry><refentrytitle>onnode</refentrytitle>
1831       <manvolnum>1</manvolnum></citerefentry>,
1832
1833       <citerefentry><refentrytitle>ctdb</refentrytitle>
1834       <manvolnum>7</manvolnum></citerefentry>,
1835
1836       <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1837       <manvolnum>7</manvolnum></citerefentry>,
1838
1839       <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1840       <manvolnum>7</manvolnum></citerefentry>,
1841
1842       <ulink url="http://ctdb.samba.org/"/>
1843     </para>
1844   </refsect1>
1845
1846
1847 </refentry>