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