5c3ce410c0c9df33c98f51a70d4df52d58aa5d80
[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       <para>
613         The commands below require a component to be specified.  In
614         the current version the only valid component is
615         <literal>legacy</literal>.
616       </para>
617
618       <variablelist>
619         <varlistentry>
620           <term>run <parameter>TIMEOUT</parameter> <parameter>COMPONENT</parameter> <parameter>EVENT</parameter> <optional><parameter>ARGUMENTS</parameter></optional> </term>
621           <listitem>
622             <para>
623              This command can be used to manually run specified EVENT
624              in COMPONENT with optional ARGUMENTS.  The event will be
625              allowed to run a maximum of TIMEOUT seconds.  If TIMEOUT
626              is 0, then there is no time limit for running the event.
627             </para>
628           </listitem>
629         </varlistentry>
630
631         <varlistentry>
632           <term>status <parameter>COMPONENT</parameter> <parameter>EVENT</parameter></term>
633           <listitem>
634             <para>
635               This command displays the last execution status of the
636               specified EVENT in COMPONENT.
637             </para>
638             <para>
639               The command will terminate with the exit status
640               corresponding to the overall status of event that is
641               displayed.
642             </para>
643             <para>
644               The output is the list of event scripts executed.
645               Each line shows the name, status, duration and start time
646               for each script.
647             </para>
648             <para>
649               Example output:
650             </para>
651             <screen>
652 00.ctdb              OK         0.014 Sat Dec 17 19:39:11 2016
653 01.reclock           OK         0.013 Sat Dec 17 19:39:11 2016
654 05.system            OK         0.029 Sat Dec 17 19:39:11 2016
655 06.nfs               OK         0.014 Sat Dec 17 19:39:11 2016
656 10.interface         OK         0.037 Sat Dec 17 19:39:11 2016
657 11.natgw             OK         0.011 Sat Dec 17 19:39:11 2016
658 11.routing           OK         0.007 Sat Dec 17 19:39:11 2016
659 13.per_ip_routing    OK         0.007 Sat Dec 17 19:39:11 2016
660 20.multipathd        OK         0.007 Sat Dec 17 19:39:11 2016
661 31.clamd             OK         0.007 Sat Dec 17 19:39:11 2016
662 40.vsftpd            OK         0.013 Sat Dec 17 19:39:11 2016
663 41.httpd             OK         0.018 Sat Dec 17 19:39:11 2016
664 49.winbind           OK         0.023 Sat Dec 17 19:39:11 2016
665 50.samba             OK         0.100 Sat Dec 17 19:39:12 2016
666 60.nfs               OK         0.376 Sat Dec 17 19:39:12 2016
667 70.iscsi             OK         0.009 Sat Dec 17 19:39:12 2016
668 91.lvs               OK         0.007 Sat Dec 17 19:39:12 2016
669             </screen>
670           </listitem>
671         </varlistentry>
672
673         <varlistentry>
674           <term>script list <parameter>COMPONENT</parameter></term>
675           <listitem>
676             <para>
677               List the available event scripts in COMPONENT.  Enabled
678               scripts are flagged with a '*'.
679             </para>
680             <para>
681               Generally, event scripts are provided by CTDB.  However,
682               local or 3rd party event scripts may also be available.
683               These are shown in a separate section after those
684               provided by CTDB.
685             </para>
686             <para>
687               Example output:
688             </para>
689             <screen>
690 * 00.ctdb             
691 * 01.reclock          
692 * 05.system           
693 * 06.nfs              
694 * 10.interface        
695   11.natgw            
696   11.routing          
697   13.per_ip_routing   
698   20.multipathd       
699   31.clamd            
700   40.vsftpd           
701   41.httpd            
702 * 49.winbind          
703 * 50.samba            
704 * 60.nfs              
705   70.iscsi            
706   91.lvs              
707
708 * 02.local            
709             </screen>
710           </listitem>
711         </varlistentry>
712
713         <varlistentry>
714           <term>script enable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
715           <listitem>
716             <para>
717               Enable the specified event SCRIPT in COMPONENT.  Only
718               enabled scripts will be executed when running any event.
719             </para>
720           </listitem>
721         </varlistentry>
722
723         <varlistentry>
724           <term>script disable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
725           <listitem>
726             <para>
727               Disable the specified event SCRIPT in COMPONENT.  This
728               will prevent the script from executing when running any
729               event.
730             </para>
731           </listitem>
732         </varlistentry>
733       </variablelist>
734     </refsect2>
735
736     <refsect2>
737       <title>scriptstatus</title>
738       <para>
739         This command displays which event scripts where run in the previous
740         monitoring cycle and the result of each script. If a script
741         failed with an error, causing the node to become unhealthy,
742         the output from that script is also shown.
743       </para>
744       <para>
745         This command is deprecated.  It's provided for backward
746         compatibility.  In place of <command>ctdb scriptstatus</command>,
747         use <command>ctdb event status</command>.
748       </para>
749       <refsect3>
750         <title>Example</title>
751         <screen>
752 # ctdb scriptstatus
753 00.ctdb              OK         0.011 Sat Dec 17 19:40:46 2016
754 01.reclock           OK         0.010 Sat Dec 17 19:40:46 2016
755 05.system            OK         0.030 Sat Dec 17 19:40:46 2016
756 06.nfs               OK         0.014 Sat Dec 17 19:40:46 2016
757 10.interface         OK         0.041 Sat Dec 17 19:40:46 2016
758 11.natgw             OK         0.008 Sat Dec 17 19:40:46 2016
759 11.routing           OK         0.007 Sat Dec 17 19:40:46 2016
760 13.per_ip_routing    OK         0.007 Sat Dec 17 19:40:46 2016
761 20.multipathd        OK         0.007 Sat Dec 17 19:40:46 2016
762 31.clamd             OK         0.007 Sat Dec 17 19:40:46 2016
763 40.vsftpd            OK         0.013 Sat Dec 17 19:40:46 2016
764 41.httpd             OK         0.015 Sat Dec 17 19:40:46 2016
765 49.winbind           OK         0.022 Sat Dec 17 19:40:46 2016
766 50.samba             ERROR      0.077 Sat Dec 17 19:40:46 2016
767   OUTPUT: ERROR: samba tcp port 445 is not responding
768       </screen>
769       </refsect3>
770     </refsect2>
771
772     <refsect2>
773       <title>listvars</title>
774       <para>
775         List all tuneable variables, except the values of the obsolete tunables
776         like VacuumMinInterval. The obsolete tunables can be retrieved only
777         explicitly with the "ctdb getvar" command.
778       </para>
779       <refsect3>
780         <title>Example</title>
781         <screen>
782 # ctdb listvars
783 SeqnumInterval          = 1000
784 ControlTimeout          = 60
785 TraverseTimeout         = 20
786 KeepaliveInterval       = 5
787 KeepaliveLimit          = 5
788 RecoverTimeout          = 120
789 RecoverInterval         = 1
790 ElectionTimeout         = 3
791 TakeoverTimeout         = 9
792 MonitorInterval         = 15
793 TickleUpdateInterval    = 20
794 EventScriptTimeout      = 30
795 MonitorTimeoutCount     = 20
796 RecoveryGracePeriod     = 120
797 RecoveryBanPeriod       = 300
798 DatabaseHashSize        = 100001
799 DatabaseMaxDead         = 5
800 RerecoveryTimeout       = 10
801 EnableBans              = 1
802 NoIPFailback            = 0
803 DisableIPFailover       = 0
804 VerboseMemoryNames      = 0
805 RecdPingTimeout         = 60
806 RecdFailCount           = 10
807 LogLatencyMs            = 0
808 RecLockLatencyMs        = 1000
809 RecoveryDropAllIPs      = 120
810 VacuumInterval          = 10
811 VacuumMaxRunTime        = 120
812 RepackLimit             = 10000
813 VacuumLimit             = 5000
814 VacuumFastPathCount     = 60
815 MaxQueueDropMsg         = 1000000
816 AllowUnhealthyDBRead    = 0
817 StatHistoryInterval     = 1
818 DeferredAttachTO        = 120
819 AllowClientDBAttach     = 1
820 RecoverPDBBySeqNum      = 1
821 DeferredRebalanceOnNodeAdd = 300
822 FetchCollapse           = 1
823 HopcountMakeSticky      = 50
824 StickyDuration          = 600
825 StickyPindown           = 200
826 NoIPTakeover            = 0
827 DBRecordCountWarn       = 100000
828 DBRecordSizeWarn        = 10000000
829 DBSizeWarn              = 100000000
830 PullDBPreallocation     = 10485760
831 TDBMutexEnabled         = 1
832 LockProcessesPerDB      = 200
833 RecBufferSizeLimit      = 1000000
834 QueueBufferSize         = 1024
835 IPAllocAlgorithm        = 2
836         </screen>
837       </refsect3>
838     </refsect2>
839
840     <refsect2>
841       <title>getvar <parameter>NAME</parameter></title>
842       <para>
843         Get the runtime value of a tuneable variable.
844       </para>
845       <refsect3>
846         <title>Example</title>
847         <screen>
848 # ctdb getvar MonitorInterval
849 MonitorInterval         = 15
850         </screen>
851       </refsect3>
852     </refsect2>
853
854     <refsect2>
855       <title>setvar <parameter>NAME</parameter> <parameter>VALUE</parameter></title>
856       <para>
857         Set the runtime value of a tuneable variable.
858       </para>
859       <refsect3>
860         <title>Example</title>
861         <screen>
862 # ctdb setvar MonitorInterval 20
863         </screen>
864       </refsect3>
865     </refsect2>
866
867     <refsect2>
868       <title>lvs {master|list|status}</title>
869       <para>
870         This command shows different aspects of LVS status.  For an
871         overview of CTDB's LVS functionality please see the
872         <citetitle>LVS</citetitle> section in
873         <citerefentry><refentrytitle>ctdb</refentrytitle>
874         <manvolnum>7</manvolnum></citerefentry>.
875       </para>
876
877       <variablelist>
878         <varlistentry>
879           <term>master</term>
880           <listitem>
881             <para>
882               Shows the PNN of the current LVS master node.
883             </para>
884       <para>
885         Example output:
886       </para>
887       <screen>
888 2
889       </screen>
890           </listitem>
891         </varlistentry>
892         <varlistentry>
893           <term>list</term>
894           <listitem>
895             <para>
896               Lists the currently usable LVS nodes.
897             </para>
898       <para>
899         Example output:
900       </para>
901       <screen>
902 2 10.0.0.13
903 3 10.0.0.14
904       </screen>
905           </listitem>
906         </varlistentry>
907         <varlistentry>
908           <term>status</term>
909           <listitem>
910             <para>
911               List the nodes in the current LVS group and their status.
912             </para>
913       <para>
914         Example output:
915       </para>
916       <screen>
917 pnn:0 10.0.0.11        UNHEALTHY (THIS NODE)
918 pnn:1 10.0.0.12        UNHEALTHY
919 pnn:2 10.0.0.13        OK
920 pnn:3 10.0.0.14        OK
921       </screen>
922           </listitem>
923         </varlistentry>
924       </variablelist>
925
926     </refsect2>
927
928
929     <refsect2>
930       <title>getcapabilities</title>
931
932       <para>
933         This command shows the capabilities of the current node.  See
934         the <citetitle>CAPABILITIES</citetitle> section in
935         <citerefentry><refentrytitle>ctdb</refentrytitle>
936         <manvolnum>7</manvolnum></citerefentry> for more details.
937       </para>
938
939       <para>
940         Example output:
941       </para>
942       <screen>
943 RECMASTER: YES
944 LMASTER: YES
945       </screen>
946
947     </refsect2>
948
949     <refsect2>
950       <title>statistics</title>
951       <para>
952         Collect statistics from the CTDB daemon about
953         how many calls it has served.  Information about
954         various fields in statistics can be found in
955         <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
956         <manvolnum>7</manvolnum></citerefentry>.
957       </para>
958       <refsect3>
959         <title>Example</title>
960         <screen>
961 # ctdb statistics
962 CTDB version 1
963 Current time of statistics  :                Tue Mar  8 15:18:51 2016
964 Statistics collected since  : (003 21:31:32) Fri Mar  4 17:47:19 2016
965  num_clients                        9
966  frozen                             0
967  recovering                         0
968  num_recoveries                     2
969  client_packets_sent          8170534
970  client_packets_recv          7166132
971  node_packets_sent           16549998
972  node_packets_recv            5244418
973  keepalive_packets_sent        201969
974  keepalive_packets_recv        201969
975  node
976      req_call                      26
977      reply_call                     0
978      req_dmaster                    9
979      reply_dmaster                 12
980      reply_error                    0
981      req_message              1339231
982      req_control              8177506
983      reply_control            6831284
984  client
985      req_call                      15
986      req_message               334809
987      req_control              6831308
988  timeouts
989      call                           0
990      control                        0
991      traverse                       0
992  locks
993      num_calls                      8
994      num_current                    0
995      num_pending                    0
996      num_failed                     0
997  total_calls                       15
998  pending_calls                      0
999  childwrite_calls                   0
1000  pending_childwrite_calls             0
1001  memory_used                   394879
1002  max_hop_count                      1
1003  total_ro_delegations               0
1004  total_ro_revokes                   0
1005  hop_count_buckets: 8 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1006  lock_buckets: 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0
1007  locks_latency      MIN/AVG/MAX     0.010005/0.010418/0.011010 sec out of 8
1008  reclock_ctdbd      MIN/AVG/MAX     0.002538/0.002538/0.002538 sec out of 1
1009  reclock_recd       MIN/AVG/MAX     0.000000/0.000000/0.000000 sec out of 0
1010  call_latency       MIN/AVG/MAX     0.000044/0.002142/0.011702 sec out of 15
1011  childwrite_latency MIN/AVG/MAX     0.000000/0.000000/0.000000 sec out of 0
1012         </screen>
1013       </refsect3>
1014     </refsect2>
1015
1016     <refsect2>
1017       <title>statisticsreset</title>
1018       <para>
1019         This command is used to clear all statistics counters in a node.
1020       </para>
1021       <para>
1022         Example: ctdb statisticsreset
1023       </para>
1024     </refsect2>
1025
1026     <refsect2>
1027       <title>dbstatistics <parameter>DB</parameter></title>
1028       <para>
1029         Display statistics about the database DB.  Information
1030         about various fields in dbstatistics can be found in
1031         <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1032         <manvolnum>7</manvolnum></citerefentry>.
1033       </para>
1034       <refsect3>
1035         <title>Example</title>
1036         <screen>
1037 # ctdb dbstatistics locking.tdb
1038 DB Statistics: locking.tdb
1039  ro_delegations                     0
1040  ro_revokes                         0
1041  locks
1042      total                      14356
1043      failed                         0
1044      current                        0
1045      pending                        0
1046  hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1047  lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
1048  locks_latency      MIN/AVG/MAX     0.001066/0.012686/4.202292 sec out of 14356
1049  vacuum_latency     MIN/AVG/MAX     0.000472/0.002207/15.243570 sec out of 224530
1050  Num Hot Keys:     1
1051      Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
1052         </screen>
1053       </refsect3>
1054     </refsect2>
1055
1056     <refsect2>
1057       <title>getreclock</title>
1058       <para>
1059         Show details of the recovery lock, if any.
1060       </para>
1061
1062       <para>
1063         Example output:
1064       </para>
1065       <screen>
1066         /clusterfs/.ctdb/recovery.lock
1067       </screen>
1068
1069     </refsect2>
1070
1071     <refsect2>
1072       <title>getdebug</title>
1073       <para>
1074         Get the current debug level for the node. the debug level controls what information is written to the log file.
1075       </para>
1076       <para>
1077         The debug levels are mapped to the corresponding syslog levels.
1078         When a debug level is set, only those messages at that level and higher
1079         levels will be printed.
1080       </para>
1081       <para>
1082         The list of debug levels from highest to lowest are :
1083       </para>
1084       <para>
1085         ERROR WARNING NOTICE INFO DEBUG
1086       </para>
1087     </refsect2>
1088
1089     <refsect2>
1090       <title>setdebug <parameter>DEBUGLEVEL</parameter></title>
1091       <para>
1092         Set the debug level of a node. This controls what information will be logged.
1093       </para>
1094       <para>
1095         The debuglevel is one of ERROR WARNING NOTICE INFO DEBUG
1096       </para>
1097     </refsect2>
1098
1099     <refsect2>
1100       <title>getpid</title>
1101       <para>
1102         This command will return the process id of the ctdb daemon.
1103       </para>
1104     </refsect2>
1105
1106     <refsect2>
1107       <title>disable</title>
1108       <para>
1109         This command is used to administratively disable a node in the cluster.
1110         A disabled node will still participate in the cluster and host
1111         clustered TDB records but its public ip address has been taken over by
1112         a different node and it no longer hosts any services.
1113       </para>
1114     </refsect2>
1115
1116     <refsect2>
1117       <title>enable</title>
1118       <para>
1119         Re-enable a node that has been administratively disabled.
1120       </para>
1121     </refsect2>
1122
1123     <refsect2>
1124       <title>stop</title>
1125       <para>
1126         This command is used to administratively STOP a node in the cluster.
1127         A STOPPED node is connected to the cluster but will not host any
1128         public ip addresse, nor does it participate in the VNNMAP.
1129         The difference between a DISABLED node and a STOPPED node is that
1130         a STOPPED node does not host any parts of the database which means
1131         that a recovery is required to stop/continue nodes.
1132       </para>
1133     </refsect2>
1134
1135     <refsect2>
1136       <title>continue</title>
1137       <para>
1138         Re-start a node that has been administratively stopped.
1139       </para>
1140     </refsect2>
1141
1142     <refsect2>
1143       <title>addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter></title>
1144       <para>
1145         This command is used to add a new public ip to a node
1146         during runtime.  It should be followed by a <command>ctdb
1147         ipreallocate</command>.  This allows public addresses to be
1148         added to a cluster without having to restart the ctdb daemons.
1149       </para>
1150       <para>
1151         Note that this only updates the runtime instance of ctdb. Any
1152         changes will be lost next time ctdb is restarted and the public
1153         addresses file is re-read.  If you want this change to be
1154         permanent you must also update the public addresses file manually.
1155       </para>
1156     </refsect2>
1157
1158     <refsect2>
1159       <title>delip <parameter>IPADDR</parameter></title>
1160       <para>
1161         This command flags IPADDR for deletion from a node at runtime.
1162         It should be followed by a <command>ctdb
1163         ipreallocate</command>.  If IPADDR is currently hosted by the
1164         node it is being removed from, this ensures that the IP will
1165         first be failed over to another node, if possible, and that it
1166         is then actually removed.
1167       </para>
1168       <para>
1169         Note that this only updates the runtime instance of CTDB.  Any
1170         changes will be lost next time CTDB is restarted and the
1171         public addresses file is re-read.  If you want this change to
1172         be permanent you must also update the public addresses file
1173         manually.
1174       </para>
1175     </refsect2>
1176
1177     <refsect2>
1178       <title>moveip <parameter>IPADDR</parameter> <parameter>PNN</parameter></title>
1179       <para>
1180         This command can be used to manually fail a public ip address to a
1181         specific node.
1182       </para>
1183       <para>
1184         In order to manually override the "automatic" distribution of public 
1185         ip addresses that ctdb normally provides, this command only works
1186         when you have changed the tunables for the daemon to:
1187       </para>
1188       <para>
1189         IPAllocAlgorithm != 0
1190       </para>
1191       <para>
1192         NoIPFailback = 1
1193       </para>
1194     </refsect2>
1195
1196     <refsect2>
1197       <title>shutdown</title>
1198       <para>
1199         This command will shutdown a specific CTDB daemon.
1200       </para>
1201     </refsect2>
1202
1203     <refsect2>
1204       <title>setlmasterrole on|off</title>
1205       <para>
1206         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.
1207       </para>
1208
1209       <para>
1210         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.
1211       </para>
1212       <para>
1213         Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
1214       </para>
1215       <para>
1216         See also "ctdb getcapabilities"
1217       </para>
1218     </refsect2>
1219
1220     <refsect2>
1221       <title>setrecmasterrole on|off</title>
1222       <para>
1223         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.
1224       </para>
1225
1226       <para>
1227         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.
1228       </para>
1229       <para>
1230         See also "ctdb getcapabilities"
1231       </para>
1232     </refsect2>
1233
1234     <refsect2>
1235       <title>reloadnodes</title>
1236       <para>
1237         This command is used when adding new nodes, or removing
1238         existing nodes from an existing cluster.
1239       </para>
1240       <para>
1241         Procedure to add nodes:
1242       </para>
1243       <orderedlist>
1244         <listitem>
1245           <para>
1246              To expand an existing cluster, first ensure with
1247              <command>ctdb status</command> that all nodes are up and
1248              running and that they are all healthy.  Do not try to
1249              expand a cluster unless it is completely healthy!
1250           </para>
1251         </listitem>
1252         <listitem>
1253           <para>
1254             On all nodes, edit <filename>/usr/local/etc/ctdb/nodes</filename>
1255             and <emphasis>add the new nodes at the end of this
1256             file</emphasis>.
1257           </para>
1258         </listitem>
1259         <listitem>
1260           <para>
1261             Verify that all the nodes have identical
1262             <filename>/usr/local/etc/ctdb/nodes</filename> files after adding
1263             the new nodes.
1264           </para>
1265         </listitem>
1266         <listitem>
1267           <para>
1268             Run <command>ctdb reloadnodes</command> to force all nodes
1269             to reload the nodes file.
1270           </para>
1271         </listitem>
1272         <listitem>
1273           <para>
1274             Use <command>ctdb status</command> on all nodes and verify
1275             that they now show the additional nodes.
1276           </para>
1277         </listitem>
1278         <listitem>
1279           <para>
1280             Install and configure the new node and bring it online.
1281           </para>
1282         </listitem>
1283       </orderedlist>
1284       <para>
1285         Procedure to remove nodes:
1286       </para>
1287       <orderedlist>
1288         <listitem>
1289           <para>
1290             To remove nodes from an existing cluster, first ensure
1291             with <command>ctdb status</command> that all nodes, except
1292             the node to be deleted, are up and running and that they
1293             are all healthy.  Do not try to remove nodes from a
1294             cluster unless the cluster is completely healthy!
1295           </para>
1296         </listitem>
1297         <listitem>
1298           <para>
1299             Shutdown and power off the node to be removed.
1300           </para>
1301         </listitem>
1302         <listitem>
1303           <para>
1304             On all other nodes, edit the
1305             <filename>/usr/local/etc/ctdb/nodes</filename> file and
1306             <emphasis>comment out</emphasis> the nodes to be removed.
1307             <emphasis>Do not delete the lines for the deleted
1308             nodes</emphasis>, just comment them out by adding a '#' at
1309             the beginning of the lines.
1310           </para>
1311         </listitem>
1312         <listitem>
1313           <para>
1314             Run <command>ctdb reloadnodes</command> to force all nodes
1315             to reload the nodes file.
1316           </para>
1317         </listitem>
1318         <listitem>
1319           <para>
1320             Use <command>ctdb status</command> on all nodes and verify
1321             that the deleted nodes are no longer listed.
1322           </para>
1323         </listitem>
1324       </orderedlist>
1325
1326     </refsect2>
1327
1328     <refsect2>
1329       <title>
1330         reloadips
1331         <optional><parameter>PNN-LIST</parameter></optional>
1332       </title>
1333       <para>
1334         This command reloads the public addresses configuration file
1335         on the specified nodes.  When it completes addresses will be
1336         reconfigured and reassigned across the cluster as necessary.
1337       </para>
1338
1339       <para>
1340         This command is currently unable to make changes to the
1341         netmask or interfaces associated with existing addresses.
1342         Such changes must be made in 2 steps by deleting addresses in
1343         question and re-adding then.  Unfortunately this will disrupt
1344         connections to the changed addresses.
1345       </para>
1346     </refsect2>
1347
1348     <refsect2>
1349       <title>getdbmap</title>
1350       <para>
1351         This command lists all clustered TDB databases that the CTDB
1352         daemon has attached to. Some databases are flagged as PERSISTENT,
1353         this means that the database stores data persistently and the
1354         data will remain across reboots. One example of such a database
1355         is secrets.tdb where information about how the cluster was joined
1356         to the domain is stored.  Some database are flagged as REPLICATED,
1357         this means that the data in that database is replicated across all
1358         the nodes.  But the data will not remain across reboots.  This
1359         type of database is used by CTDB to store it's internal state.
1360       </para>
1361       <para>
1362         If a PERSISTENT database is not in a healthy state the database
1363         is flagged as UNHEALTHY. If there's at least one completely
1364         healthy node running in the cluster, it's possible that the
1365         content is restored by a recovery run automaticly. Otherwise an
1366         administrator needs to analyze the problem.
1367       </para>
1368       <para>
1369         See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1370         "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1371         and (if samba or tdb-utils are installed) "tdbtool check".
1372       </para>
1373       <para>
1374         Most databases are not persistent and only store the state
1375         information that the currently running samba daemons need. These
1376         databases are always wiped when ctdb/samba starts and when a
1377         node is rebooted.
1378       </para>
1379
1380       <refsect3>
1381         <title>Example</title>
1382         <screen>
1383 # ctdb getdbmap
1384 Number of databases:10
1385 dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
1386 dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
1387 dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
1388 dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
1389 dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
1390 dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
1391 dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1392 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
1393 dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1394 dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
1395
1396 # ctdb getdbmap  # example for unhealthy database
1397 Number of databases:1
1398 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1399
1400 # ctdb -X getdbmap
1401 |ID|Name|Path|Persistent|Unhealthy|
1402 |0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
1403         </screen>
1404       </refsect3>
1405     </refsect2>
1406
1407     <refsect2>
1408       <title>
1409         backupdb
1410         <parameter>DB</parameter>
1411         <parameter>FILE</parameter>
1412       </title>
1413       <para>
1414         Copy the contents of database DB to FILE.  FILE can later be
1415         read back using <command>restoredb</command>.  This is mainly
1416         useful for backing up persistent databases such as
1417         <filename>secrets.tdb</filename> and similar.
1418       </para>
1419     </refsect2>
1420
1421     <refsect2>
1422       <title>
1423         restoredb
1424         <parameter>FILE</parameter>
1425         <optional><parameter>DB</parameter></optional>
1426       </title>
1427       <para>
1428         This command restores a persistent database that was
1429         previously backed up using backupdb.  By default the data will
1430         be restored back into the same database as it was created
1431         from. By specifying dbname you can restore the data into a
1432         different database.
1433       </para>
1434     </refsect2>
1435
1436     <refsect2>
1437       <title>setdbreadonly <parameter>DB</parameter></title>
1438       <para>
1439         This command will enable the read-only record support for a
1440         database.  This is an experimental feature to improve
1441         performance for contended records primarily in locking.tdb and
1442         brlock.tdb.  When enabling this feature you must set it on all
1443         nodes in the cluster.
1444       </para>
1445     </refsect2>
1446
1447     <refsect2>
1448       <title>setdbsticky <parameter>DB</parameter></title>
1449       <para>
1450         This command will enable the sticky record support for the
1451         specified database.  This is an experimental feature to
1452         improve performance for contended records primarily in
1453         locking.tdb and brlock.tdb.  When enabling this feature you
1454         must set it on all nodes in the cluster.
1455       </para>
1456     </refsect2>
1457
1458   </refsect1>
1459
1460   <refsect1>
1461     <title>INTERNAL COMMANDS</title>
1462
1463     <para>
1464       Internal commands are used by CTDB's scripts and are not
1465       required for managing a CTDB cluster.  Their parameters and
1466       behaviour are subject to change.
1467     </para>
1468
1469     <refsect2>
1470       <title>gettickles <parameter>IPADDR</parameter></title>
1471       <para>
1472         Show TCP connections that are registered with CTDB to be
1473         "tickled" if there is a failover.
1474       </para>
1475     </refsect2>
1476
1477     <refsect2>
1478       <title>gratarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1479       <para>
1480         Send out a gratuitous ARP for the specified interface through
1481         the specified interface. This command is mainly used by the
1482         ctdb eventscripts.
1483       </para>
1484     </refsect2>
1485
1486     <refsect2>
1487       <title>
1488         pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1489       </title>
1490       <para>
1491         Delete KEY from DB.
1492       </para>
1493     </refsect2>
1494
1495     <refsect2>
1496       <title>
1497         pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1498       </title>
1499       <para>
1500         Print the value associated with KEY in DB.
1501       </para>
1502     </refsect2>
1503
1504     <refsect2>
1505       <title>
1506         pstore
1507         <parameter>DB</parameter>
1508         <parameter>KEY</parameter>
1509         <parameter>FILE</parameter>
1510       </title>
1511       <para>
1512         Store KEY in DB with contents of FILE as the associated value.
1513       </para>
1514     </refsect2>
1515
1516     <refsect2>
1517       <title>
1518         ptrans
1519         <parameter>DB</parameter>
1520         <optional><parameter>FILE</parameter></optional>
1521       </title>
1522       <para>
1523         Read a list of key-value pairs, one per line from FILE, and
1524         store them in DB using a single transaction.  An empty value
1525         is equivalent to deleting the given key.
1526       </para>
1527       <para>
1528         The key and value should be separated by spaces or tabs. Each
1529         key/value should be a printable string enclosed in
1530         double-quotes.
1531       </para>
1532     </refsect2>
1533
1534     <refsect2>
1535       <title>runstate [setup|first_recovery|startup|running]</title>
1536       <para>
1537         Print the runstate of the specified node.  Runstates are used
1538         to serialise important state transitions in CTDB, particularly
1539         during startup.
1540       </para>
1541       <para>
1542         If one or more optional runstate arguments are specified then
1543         the node must be in one of these runstates for the command to
1544         succeed.
1545       </para>
1546       <refsect3>
1547         <title>Example</title>
1548         <screen>
1549 # ctdb runstate
1550 RUNNING
1551         </screen>
1552       </refsect3>
1553     </refsect2>
1554
1555     <refsect2>
1556       <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1557       <para>
1558         Set the internal state of network interface IFACE.  This is
1559         typically used in the <filename>10.interface</filename> script
1560         in the "monitor" event.
1561       </para>
1562       <para>
1563         Example: ctdb setifacelink eth0 up
1564       </para>
1565     </refsect2>
1566
1567     <refsect2>
1568       <title>tickle</title>
1569       <para>
1570         Read a list of TCP connections, one per line, from standard
1571         input and send a TCP tickle to the source host for each
1572         connection.  A connection is specified as:
1573       </para>
1574       <synopsis>
1575         <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1576       </synopsis>
1577       <para>
1578         A single connection can be specified on the command-line
1579         rather than on standard input.
1580       </para>
1581       <para>
1582         A TCP tickle is a TCP ACK packet with an invalid sequence and
1583         acknowledge number and will when received by the source host
1584         result in it sending an immediate correct ACK back to the
1585         other end.
1586       </para>
1587       <para>
1588         TCP tickles are useful to "tickle" clients after a IP failover has
1589         occurred since this will make the client immediately recognize the
1590         TCP connection has been disrupted and that the client will need
1591         to reestablish. This greatly speeds up the time it takes for a client
1592         to detect and reestablish after an IP failover in the ctdb cluster.
1593       </para>
1594     </refsect2>
1595
1596     <refsect2>
1597       <title>version</title>
1598       <para>
1599         Display the CTDB version.
1600       </para>
1601     </refsect2>
1602
1603   </refsect1>
1604
1605   <refsect1>
1606     <title>DEBUGGING COMMANDS</title>
1607     <para>
1608       These commands are primarily used for CTDB development and testing and
1609       should not be used for normal administration.
1610     </para>
1611
1612
1613     <refsect2>
1614       <title>OPTIONS</title>
1615
1616       <variablelist>
1617         <varlistentry><term>--print-emptyrecords</term>
1618         <listitem>
1619           <para>
1620             This enables printing of empty records when dumping databases
1621             with the catdb, cattbd and dumpdbbackup commands. Records with
1622             empty data segment are considered deleted by ctdb and cleaned
1623             by the vacuuming mechanism, so this switch can come in handy for
1624             debugging the vacuuming behaviour.
1625           </para>
1626         </listitem>
1627         </varlistentry>
1628
1629         <varlistentry><term>--print-datasize</term>
1630         <listitem>
1631           <para>
1632             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1633             size of the record data instead of dumping the data contents.
1634           </para>
1635         </listitem>
1636         </varlistentry>
1637
1638         <varlistentry><term>--print-lmaster</term>
1639         <listitem>
1640           <para>
1641             This lets catdb print the lmaster for each record.
1642           </para>
1643         </listitem>
1644         </varlistentry>
1645
1646         <varlistentry><term>--print-hash</term>
1647         <listitem>
1648           <para>
1649             This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1650             hash for each record.
1651           </para>
1652         </listitem>
1653         </varlistentry>
1654
1655         <varlistentry><term>--print-recordflags</term>
1656         <listitem>
1657           <para>
1658             This lets catdb and dumpdbbackup print the
1659             record flags for each record. Note that cattdb always
1660             prints the flags.
1661           </para>
1662         </listitem>
1663         </varlistentry>
1664
1665       </variablelist>
1666     </refsect2>
1667
1668     <refsect2>
1669       <title>process-exists <parameter>PID</parameter> <parameter>[SRVID]</parameter></title>
1670       <para>
1671         This command checks if a specific process exists on the CTDB
1672         host. This is mainly used by Samba to check if remote instances
1673         of samba are still running or not.  When the optional SRVID
1674         argument is specified, the command check if a specific process
1675         exists on the CTDB host and has registered for specified SRVID.
1676       </para>
1677     </refsect2>
1678
1679     <refsect2>
1680       <title>getdbstatus <parameter>DB</parameter></title>
1681       <para>
1682         This command displays more details about a database.
1683       </para>
1684       <refsect3>
1685         <title>Example</title>
1686         <screen>
1687 # ctdb getdbstatus test.tdb.0
1688 dbid: 0x122224da
1689 name: test.tdb
1690 path: /usr/local/var/lib/ctdb/test.tdb.0
1691 PERSISTENT: no
1692 HEALTH: OK
1693
1694 # ctdb getdbstatus registry.tdb  # with a corrupted TDB
1695 dbid: 0xf2a58948
1696 name: registry.tdb
1697 path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
1698 PERSISTENT: yes
1699 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1700         </screen>
1701       </refsect3>
1702     </refsect2>
1703
1704     <refsect2>
1705       <title>catdb <parameter>DB</parameter></title>
1706       <para>
1707         Print a dump of the clustered TDB database DB.
1708       </para>
1709     </refsect2>
1710
1711     <refsect2>
1712       <title>cattdb <parameter>DB</parameter></title>
1713       <para>
1714         Print a dump of the contents of the local TDB database DB.
1715       </para>
1716     </refsect2>
1717
1718     <refsect2>
1719       <title>dumpdbbackup <parameter>FILE</parameter></title>
1720       <para>
1721         Print a dump of the contents from database backup FILE,
1722         similar to <command>catdb</command>.
1723       </para>
1724     </refsect2>
1725
1726     <refsect2>
1727       <title>wipedb <parameter>DB</parameter></title>
1728       <para>
1729         Remove all contents of database DB.
1730       </para>
1731     </refsect2>
1732
1733     <refsect2>
1734       <title>recover</title>
1735       <para>
1736         This command will trigger the recovery daemon to do a cluster
1737         recovery.
1738       </para>
1739     </refsect2>
1740
1741     <refsect2>
1742       <title>ipreallocate, sync</title>
1743       <para>
1744         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.
1745       </para>
1746     </refsect2>
1747
1748     <refsect2>
1749       <title>attach <parameter>DBNAME</parameter> [persistent|replicated]</title>
1750       <para>
1751         Create a new CTDB database called DBNAME and attach to it on
1752         all nodes.
1753       </para>
1754     </refsect2>
1755
1756     <refsect2>
1757       <title>detach <parameter>DB-LIST</parameter></title>
1758       <para>
1759         Detach specified non-persistent database(s) from the cluster. This
1760         command will disconnect specified database(s) on all nodes in
1761         the cluster.  This command should only be used when none of the
1762         specified database(s) are in use.
1763       </para>
1764       <para>
1765         All nodes should be active and tunable AllowClientDBAccess should
1766         be disabled on all nodes before detaching databases.
1767       </para>
1768     </refsect2>
1769
1770     <refsect2>
1771       <title>dumpmemory</title>
1772       <para>
1773         This is a debugging command. This command will make the ctdb
1774         daemon to write a fill memory allocation map to standard output.
1775       </para>
1776     </refsect2>
1777
1778     <refsect2>
1779       <title>rddumpmemory</title>
1780       <para>
1781         This is a debugging command. This command will dump the talloc memory
1782         allocation tree for the recovery daemon to standard output.
1783       </para>
1784     </refsect2>
1785
1786     <refsect2>
1787       <title>ban <parameter>BANTIME</parameter></title>
1788       <para>
1789         Administratively ban a node for BANTIME seconds.  The node
1790         will be unbanned after BANTIME seconds have elapsed.
1791       </para>
1792       <para>
1793         A banned node does not participate in the cluster.  It does
1794         not host any records for the clustered TDB and does not host
1795         any public IP addresses.
1796       </para>
1797       <para>
1798         Nodes are automatically banned if they misbehave.  For
1799         example, a node may be banned if it causes too many cluster
1800         recoveries.
1801       </para>
1802       <para>
1803         To administratively exclude a node from a cluster use the
1804         <command>stop</command> command.
1805       </para>
1806     </refsect2>
1807
1808     <refsect2>
1809       <title>unban</title>
1810       <para>
1811         This command is used to unban a node that has either been
1812         administratively banned using the ban command or has been
1813         automatically banned.
1814       </para>
1815     </refsect2>
1816
1817   </refsect1>
1818
1819   <!-- UNDOCUMENTED: stats
1820        isnotrecmaster addtickle deltickle
1821        tfetch tstore readkey writekey
1822        checktcpport getdbseqnum
1823   -->
1824
1825   <refsect1>
1826     <title>SEE ALSO</title>
1827     <para>
1828       <citerefentry><refentrytitle>ctdbd</refentrytitle>
1829       <manvolnum>1</manvolnum></citerefentry>,
1830
1831       <citerefentry><refentrytitle>onnode</refentrytitle>
1832       <manvolnum>1</manvolnum></citerefentry>,
1833
1834       <citerefentry><refentrytitle>ctdb</refentrytitle>
1835       <manvolnum>7</manvolnum></citerefentry>,
1836
1837       <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1838       <manvolnum>7</manvolnum></citerefentry>,
1839
1840       <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1841       <manvolnum>7</manvolnum></citerefentry>,
1842
1843       <ulink url="http://ctdb.samba.org/"/>
1844     </para>
1845   </refsect1>
1846
1847
1848 </refentry>