merge from volker
[metze/ctdb/wip.git] / doc / ctdb.1.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="ctdb.1">
4
5 <refmeta>
6         <refentrytitle>ctdb</refentrytitle>
7         <manvolnum>1</manvolnum>
8 </refmeta>
9
10
11 <refnamediv>
12         <refname>ctdb</refname>
13         <refpurpose>clustered tdb database management utility</refpurpose>
14 </refnamediv>
15
16 <refsynopsisdiv>
17         <cmdsynopsis>
18                 <command>ctdb [ OPTIONS ] COMMAND ...</command>
19         </cmdsynopsis>
20         
21         <cmdsynopsis>
22                 <command>ctdb</command>
23                 <arg choice="opt">-n &lt;node&gt;</arg>
24                 <arg choice="opt">-Y</arg>
25                 <arg choice="opt">-t &lt;timeout&gt;</arg>
26                 <arg choice="opt">-? --help</arg>
27                 <arg choice="opt">--usage</arg>
28                 <arg choice="opt">-d --debug=&lt;INTEGER&gt;</arg>
29                 <arg choice="opt">--socket=&lt;filename&gt;</arg>
30         </cmdsynopsis>
31         
32 </refsynopsisdiv>
33
34   <refsect1><title>DESCRIPTION</title>
35     <para>
36       ctdb is a utility to view and manage a ctdb cluster.
37     </para>
38   </refsect1>
39
40
41   <refsect1>
42     <title>OPTIONS</title>
43
44     <variablelist>
45       <varlistentry><term>-n &lt;vnn&gt;</term>
46         <listitem>
47           <para>
48             This specifies the virtual node number on which to execute the 
49             command. Default is to run the command on the deamon running on 
50             the local host.
51           </para>
52           <para>
53             The virtual node number is an integer that describes the node in the
54             cluster. The first node has virtual node number 0.
55           </para>
56         </listitem>
57       </varlistentry>
58
59       <varlistentry><term>-Y</term>
60         <listitem>
61           <para>
62             Produce output in machine readable form for easier parsing by scripts. Not all commands support this option.
63           </para>
64         </listitem>
65       </varlistentry>
66
67       <varlistentry><term>-t &lt;timeout&gt;</term>
68         <listitem>
69           <para>
70             How long should ctdb wait for a command to complete before timing out. Default is 3 seconds.
71           </para>
72         </listitem>
73       </varlistentry>
74
75       <varlistentry><term>-? --help</term>
76         <listitem>
77           <para>
78             Print some help text to the screen.
79           </para>
80         </listitem>
81       </varlistentry>
82
83       <varlistentry><term>--usage</term>
84         <listitem>
85           <para>
86             Print useage information to the screen.
87           </para>
88         </listitem>
89       </varlistentry>
90
91       <varlistentry><term>-d --debug=&lt;debuglevel&gt;</term>
92         <listitem>
93           <para>
94             Change the debug level for the command. Default is 0.
95           </para>
96         </listitem>
97       </varlistentry>
98
99       <varlistentry><term>--socket=&lt;filename&gt;</term>
100         <listitem>
101           <para>
102             Specify the socketname to use when connecting to the local ctdb 
103             daemon. The default is /tmp/ctdb.socket .
104           </para>
105           <para>
106             You only need to specify this parameter if you run multiple ctdb 
107             daemons on the same physical host and thus can not use the default
108             name for the domain socket.
109           </para>
110         </listitem>
111       </varlistentry>
112
113     </variablelist>
114   </refsect1>
115
116
117   <refsect1><title>Administrative Commands</title>
118     <para>
119       These are commands used to monitor and administrate a CTDB cluster.
120     </para>
121
122     <refsect2><title>status</title>
123       <para>
124         This command shows the current status of the ctdb node.
125       </para>
126
127       <refsect3><title>node status</title>
128         <para>
129           Node status reflects the current status of the node. There are four possible states:
130         </para>
131         <para>
132           OK - This node is fully functional.
133         </para>
134         <para>
135           DISCONNECTED - This node could not be connected through the network and is currently not participating in the cluster. If there is a public IP address associated with this node it should have been taken over by a different node. No services are running on this node.
136         </para>
137         <para>
138           DISABLED - This node has been administratively disabled. This node is still functional and participates in the CTDB cluster but its IP addresses have been taken over by a different node and no services are currently being hosted.
139         </para>
140         <para>
141           UNHEALTHY - A service provided by this node is malfunctioning and should be investigated. The CTDB daemon itself is operational and participates in the cluster. Its public IP address has been taken over by a different node and no services are currnetly being hosted. All unhealthy nodes should be investigated and require an administrative action to rectify.
142         </para>
143         <para>
144           BANNED - This node failed too many recovery attempts and has been banned from participating in the cluster for a period of RecoveryBanPeriod seconds. Any public IP address has been taken over by other nodes. This node does not provide any services. All banned nodes should be investigated and require an administrative action to rectify. This node does not perticipate in the CTDB cluster but can still be communicated with. I.e. ctdb commands can be sent to it.
145         </para>
146       </refsect3>
147
148       <refsect3><title>generation</title>
149         <para>
150           The generation id is a number that indicates the current generation 
151           of a cluster instance. Each time a cluster goes through a 
152           reconfiguration or a recovery its generation id will be changed.
153         </para>
154       </refsect3>
155
156       <refsect3><title>VNNMAP</title>
157         <para>
158           The list of Virtual Node Numbers. This is a list of all nodes that actively participates in the cluster and that share the workload of hosting the Clustered TDB database records.
159           Only nodes that are participating in the vnnmap can become lmaster or dmaster for a database record.
160         </para>
161       </refsect3>
162
163       <refsect3><title>Recovery mode</title>
164         <para>
165           This is the current recovery mode of the cluster. There are two possible modes:
166         </para>
167         <para>
168           NORMAL - The cluster is fully operational.
169         </para>
170         <para>
171           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.
172         </para>
173       </refsect3>
174
175       <refsect3><title>Recovery master</title>
176         <para>
177           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.
178         </para>
179       </refsect3>
180
181       <para>
182         Example: ctdb status
183       </para>
184       <para>Example output:</para>
185       <screen format="linespecific">
186 Number of nodes:4
187 vnn:0 11.1.2.200       OK (THIS NODE)
188 vnn:1 11.1.2.201       OK
189 vnn:2 11.1.2.202       OK
190 vnn:3 11.1.2.203       OK
191 Generation:1362079228
192 Size:4
193 hash:0 lmaster:0
194 hash:1 lmaster:1
195 hash:2 lmaster:2
196 hash:3 lmaster:3
197 Recovery mode:NORMAL (0)
198 Recovery master:0
199       </screen>
200     </refsect2>
201
202     <refsect2><title>ping</title>
203       <para>
204         This command will "ping" all CTDB daemons in the cluster to verify that they are processing commands correctly.
205       </para>
206       <para>
207         Example: ctdb ping
208       </para>
209       <para>
210         Example output:
211       </para>
212       <screen format="linespecific">
213 response from 0 time=0.000054 sec  (3 clients)
214 response from 1 time=0.000144 sec  (2 clients)
215 response from 2 time=0.000105 sec  (2 clients)
216 response from 3 time=0.000114 sec  (2 clients)
217       </screen>
218     </refsect2>
219
220     <refsect2><title>ip</title>
221       <para>
222         This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip.
223       </para>
224       <para>
225         Example: ctdb ip
226       </para>
227       <para>
228         Example output:
229       </para>
230       <screen format="linespecific">
231 Number of nodes:4
232 12.1.1.1         0
233 12.1.1.2         1
234 12.1.1.3         2
235 12.1.1.4         3
236       </screen>
237     </refsect2>
238
239     <refsect2><title>getvar &lt;name&gt;</title>
240       <para>
241         Get the runtime value of a tuneable variable.
242       </para>
243       <para>
244         Example: ctdb getvar MaxRedirectCount
245       </para>
246       <para>
247         Example output:
248       </para>
249       <screen format="linespecific">
250 MaxRedirectCount    = 3
251       </screen>
252     </refsect2>
253
254     <refsect2><title>setvar &lt;name&gt; &lt;value&gt;</title>
255       <para>
256         Set the runtime value of a tuneable variable.
257       </para>
258       <para>
259         Example: ctdb setvar MaxRedirectCount 5
260       </para>
261     </refsect2>
262
263     <refsect2><title>listvars</title>
264       <para>
265         List all tuneable variables.
266       </para>
267       <para>
268         Example: ctdb listvars
269       </para>
270       <para>
271         Example output:
272       </para>
273       <screen format="linespecific">
274 MaxRedirectCount    = 5
275 SeqnumFrequency     = 1
276 ControlTimeout      = 60
277 TraverseTimeout     = 20
278 KeepaliveInterval   = 2
279 KeepaliveLimit      = 3
280 MaxLACount          = 7
281 RecoverTimeout      = 5
282 RecoverInterval     = 1
283 ElectionTimeout     = 3
284 TakeoverTimeout     = 5
285 MonitorInterval     = 15
286 EventScriptTimeout  = 20
287 RecoveryGracePeriod = 60
288 RecoveryBanPeriod   = 300
289       </screen>
290     </refsect2>
291
292     <refsect2><title>statistics</title>
293       <para>
294         Collect statistics from the CTDB daemon about how many calls it has served.
295       </para>
296       <para>
297         Example: ctdb statistics
298       </para>
299       <para>
300         Example output:
301       </para>
302       <screen format="linespecific">
303 CTDB version 1
304  num_clients                        3
305  frozen                             0
306  recovering                         0
307  client_packets_sent           360489
308  client_packets_recv           360466
309  node_packets_sent             480931
310  node_packets_recv             240120
311  keepalive_packets_sent             4
312  keepalive_packets_recv             3
313  node
314      req_call                       2
315      reply_call                     2
316      req_dmaster                    0
317      reply_dmaster                  0
318      reply_error                    0
319      req_message                   42
320      req_control               120408
321      reply_control             360439
322  client
323      req_call                       2
324      req_message                   24
325      req_control               360440
326  timeouts
327      call                           0
328      control                        0
329      traverse                       0
330  total_calls                        2
331  pending_calls                      0
332  lockwait_calls                     0
333  pending_lockwait_calls             0
334  memory_used                     5040
335  max_hop_count                      0
336  max_call_latency                   4.948321 sec
337  max_lockwait_latency               0.000000 sec
338       </screen>
339     </refsect2>
340
341     <refsect2><title>statisticsreset</title>
342       <para>
343         This command is used to clear all statistics counters in a node.
344       </para>
345       <para>
346         Example: ctdb statisticsreset
347       </para>
348     </refsect2>
349
350     <refsect2><title>getdebug</title>
351       <para>
352         Get the current debug level for the node. the debug level controls what information is written to the log file.
353       </para>
354     </refsect2>
355
356     <refsect2><title>setdebug &lt;debuglevel&gt;</title>
357       <para>
358         Set the debug level of a node. This is a number between 0 and 9 and controls what information will be written to the logfile.
359       </para>
360     </refsect2>
361
362     <refsect2><title>getpid</title>
363       <para>
364         This command will return the process id of the ctdb daemon.
365       </para>
366     </refsect2>
367
368     <refsect2><title>disable</title>
369       <para>
370         This command is used to administratively disable a node in the cluster.
371         A disabled node will still participate in the cluster and host
372         clustered TDB records but its public ip address has been taken over by
373         a different node and it no longer hosts any services.
374       </para>
375     </refsect2>
376
377     <refsect2><title>enable</title>
378       <para>
379         Re-enable a node that has been administratively disabled.
380       </para>
381     </refsect2>
382
383     <refsect2><title>ban &lt;bantime|0&gt;</title>
384       <para>
385         Administratively ban a node for bantime seconds. A bantime of 0 means that the node should be permanently banned. 
386       </para>
387       <para>
388         A banned node does not participate in the cluster and does not host any records for the clustered TDB. Its ip address has been taken over by an other node and no services are hosted.
389       </para>
390       <para>
391         Nodes are automatically banned if they are the cause of too many
392         cluster recoveries.
393       </para>
394     </refsect2>
395
396     <refsect2><title>unban</title>
397       <para>
398         This command is used to unban a node that has either been 
399         administratively banned using the ban command or has been automatically
400         banned by the recovery daemon.
401       </para>
402     </refsect2>
403
404     <refsect2><title>shutdown</title>
405       <para>
406         This command will shutdown a specific CTDB daemon.
407       </para>
408     </refsect2>
409
410     <refsect2><title>recover</title>
411       <para>
412         This command will trigger the recovery daemon to do a cluster
413         recovery.
414       </para>
415     </refsect2>
416
417     <refsect2><title>killtcp &lt;srcip:port&gt; &lt;dstip:port&gt;</title>
418       <para>
419         This command will kill the specified TCP connection by issuing a
420         TCP RST to the srcip:port endpoint.
421       </para>
422     </refsect2>
423
424     <refsect2><title>tickle &lt;srcip:port&gt; &lt;dstip:port&gt;</title>
425       <para>
426         This command will will send a TCP tickle to the source host for the
427         specified TCP connection.
428         A TCP tickle is a TCP ACK packet with an invalid sequence and 
429         acknowledge number and will when received by the source host result
430         in it sending an immediate correct ACK back to the other end.
431       </para>
432       <para>
433         TCP tickles are useful to "tickle" clients after a IP failover has 
434         occured since this will make the client immediately recognize the 
435         TCP connection has been disrupted and that the client will need
436         to reestablish. This greatly speeds up the time it takes for a client
437         to detect and reestablish after an IP failover in the ctdb cluster.
438       </para>
439     </refsect2>
440
441   </refsect1>
442
443
444   <refsect1><title>Debugging Commands</title>
445     <para>
446       These commands are primarily used for CTDB development and testing and
447       should not be used for normal administration.
448     </para>
449     <refsect2><title>process-exists &lt;pid&gt;</title>
450       <para>
451         This command checks if a specific process exists on the CTDB host. This is mainly used by Samba to check if remote instances of samba are still running or not.
452       </para>
453     </refsect2>
454
455     <refsect2><title>getdbmap</title>
456       <para>
457         This command lists all clustered TDB databases that the CTDB daemon has attahced to.
458       </para>
459       <para>
460         Example: ctdb getdbmap
461       </para>
462       <para>
463         Example output:
464       </para>
465       <screen format="linespecific">
466 Number of databases:4
467 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0
468 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0
469 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0
470 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0
471       </screen>
472     </refsect2>
473
474     <refsect2><title>catdb &lt;dbname&gt;</title>
475       <para>
476         This command will dump a clustered TDB database to the screen. This is a debugging command.
477       </para>
478     </refsect2>
479
480     <refsect2><title>getmonmode</title>
481       <para>
482         This command returns the monutoring mode of a node. The monitoring mode is either ACTIVE or DISABLED. Normally a node will continously monitor that all other nodes that are expected are in fact connected and that they respond to commands.
483       </para>
484       <para>
485         ACTIVE - This is the normal mode. The node is actively monitoring all other nodes, both that the transport is connected and also that the node responds to commands. If a node becomes unavailable, it will be marked as DISCONNECTED and a recovery is initiated to restore the cluster.
486       </para>
487       <para>
488         DISABLED - This node is not monitoring that other nodes are available. In this mode a node failure will not be detected and no recovery will be performed. This mode is useful when for debugging purposes one wants to attach GDB to a ctdb process but wants to prevent the rest of the cluster from marking this node as DISCONNECTED and do a recovery.
489       </para>
490     </refsect2>
491
492
493     <refsect2><title>setmonmode &lt;0|1&gt;</title>
494       <para>
495         This command can be used to explicitely disable/enable monitoring mode on a node. The main purpose is if one wants to attach GDB to a running ctdb daemon but wants to prevent the other nodes from marking it as DISCONNECTED and issuing a recovery. To do this, set monitoring mode to 0 on all nodes before attaching with GDB. Remember to set monitoring mode back to 1 afterwards.
496       </para>
497     </refsect2>
498
499     <refsect2><title>attach &lt;dbname&gt;</title>
500       <para>
501         This is a debugging command. This command will make the CTDB daemon create a new CTDB database and attach to it.
502       </para>
503     </refsect2>
504
505     <refsect2><title>dumpmemory</title>
506       <para>
507         This is a debugging command. This command will make the ctdb daemon to write a fill memory allocation map to the log file.
508       </para>
509     </refsect2>
510
511     <refsect2><title>freeze</title>
512       <para>
513         This command will lock all the local TDB databases causing clients 
514         that are accessing these TDBs such as samba3 to block until the
515         databases are thawed.
516       </para>
517       <para>
518         This is primarily used by the recovery daemon to stop all samba
519         daemons from accessing any databases while the database is recovered
520         and rebuilt.
521       </para>
522     </refsect2>
523
524     <refsect2><title>thaw</title>
525       <para>
526         Thaw a previously frozen node.
527       </para>
528     </refsect2>
529
530   </refsect1>
531
532
533   <refsect1><title>SEE ALSO</title>
534     <para>
535       ctdbd(1), onnode(1)
536       <ulink url="http://ctdb.samba.org/"/>
537     </para>
538   </refsect1>
539   <refsect1><title>COPYRIGHT/LICENSE</title>
540 <literallayout>
541 Copyright (C) Andrew Tridgell 2007
542 Copyright (C) Ronnie sahlberg 2007
543
544 This program is free software; you can redistribute it and/or modify
545 it under the terms of the GNU General Public License as published by
546 the Free Software Foundation; either version 3 of the License, or (at
547 your option) any later version.
548
549 This program is distributed in the hope that it will be useful, but
550 WITHOUT ANY WARRANTY; without even the implied warranty of
551 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
552 General Public License for more details.
553
554 You should have received a copy of the GNU General Public License
555 along with this program; if not, see http://www.gnu.org/licenses/.
556 </literallayout>
557   </refsect1>
558 </refentry>