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