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