create an enum to describe the state of a control in flight instead of
[metze/ctdb/wip.git] / doc / ctdb.1.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>ctdb</title><meta name="generator" content="DocBook XSL Stylesheets V1.71.0"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="ctdb.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ctdb &#8212; clustered tdb database management utility</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">ctdb [ OPTIONS ] COMMAND ...</code> </p></div><div class="cmdsynopsis"><p><code class="command">ctdb</code>  [-n &lt;node&gt;] [-Y] [-t &lt;timeout&gt;] [-? --help] [--usage] [-d --debug=&lt;INTEGER&gt;] [--socket=&lt;filename&gt;]</p></div></div><div class="refsect1" lang="en"><a name="id2480829"></a><h2>DESCRIPTION</h2><p>
2       ctdb is a utility to view and manage a ctdb cluster.
3     </p></div><div class="refsect1" lang="en"><a name="id2480839"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-n &lt;vnn&gt;</span></dt><dd><p>
4             This specifies the virtual node number on which to execute the 
5             command. Default is to run the command on the deamon running on 
6             the local host.
7           </p><p>
8             The virtual node number is an integer that describes the node in the
9             cluster. The first node has virtual node number 0.
10           </p></dd><dt><span class="term">-Y</span></dt><dd><p>
11             Produce output in machine readable form for easier parsing by scripts. Not all commands support this option.
12           </p></dd><dt><span class="term">-t &lt;timeout&gt;</span></dt><dd><p>
13             How long should ctdb wait for a command to complete before timing out. Default is 3 seconds.
14           </p></dd><dt><span class="term">-? --help</span></dt><dd><p>
15             Print some help text to the screen.
16           </p></dd><dt><span class="term">--usage</span></dt><dd><p>
17             Print useage information to the screen.
18           </p></dd><dt><span class="term">-d --debug=&lt;debuglevel&gt;</span></dt><dd><p>
19             Change the debug level for the command. Default is 0.
20           </p></dd><dt><span class="term">--socket=&lt;filename&gt;</span></dt><dd><p>
21             Specify the socketname to use when connecting to the local ctdb 
22             daemon. The default is /tmp/ctdb.socket .
23           </p><p>
24             You only need to specify this parameter if you run multiple ctdb 
25             daemons on the same physical host and thus can not use the default
26             name for the domain socket.
27           </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2481134"></a><h2>Administrative Commands</h2><p>
28       These are commands used to monitor and administrate a CTDB cluster.
29     </p><div class="refsect2" lang="en"><a name="id2481143"></a><h3>status</h3><p>
30         This command shows the current status of the ctdb node.
31       </p><div class="refsect3" lang="en"><a name="id2481152"></a><h4>node status</h4><p>
32           Node status reflects the current status of the node. There are four possible states:
33         </p><p>
34           OK - This node is fully functional.
35         </p><p>
36           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.
37         </p><p>
38           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.
39         </p><p>
40           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.
41         </p><p>
42           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.
43         </p></div><div class="refsect3" lang="en"><a name="id2481204"></a><h4>generation</h4><p>
44           The generation id is a number that indicates the current generation 
45           of a cluster instance. Each time a cluster goes through a 
46           reconfiguration or a recovery its generation id will be changed.
47         </p></div><div class="refsect3" lang="en"><a name="id2481216"></a><h4>VNNMAP</h4><p>
48           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.
49           Only nodes that are participating in the vnnmap can become lmaster or dmaster for a database record.
50         </p></div><div class="refsect3" lang="en"><a name="id2481230"></a><h4>Recovery mode</h4><p>
51           This is the current recovery mode of the cluster. There are two possible modes:
52         </p><p>
53           NORMAL - The cluster is fully operational.
54         </p><p>
55           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.
56         </p></div><div class="refsect3" lang="en"><a name="id2481254"></a><h4>Recovery master</h4><p>
57           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.
58         </p></div><p>
59         Example: ctdb status
60       </p><p>Example output:</p><pre class="screen">
61 Number of nodes:4
62 vnn:0 11.1.2.200       OK (THIS NODE)
63 vnn:1 11.1.2.201       OK
64 vnn:2 11.1.2.202       OK
65 vnn:3 11.1.2.203       OK
66 Generation:1362079228
67 Size:4
68 hash:0 lmaster:0
69 hash:1 lmaster:1
70 hash:2 lmaster:2
71 hash:3 lmaster:3
72 Recovery mode:NORMAL (0)
73 Recovery master:0
74       </pre></div><div class="refsect2" lang="en"><a name="id2481284"></a><h3>ping</h3><p>
75         This command will "ping" all CTDB daemons in the cluster to verify that they are processing commands correctly.
76       </p><p>
77         Example: ctdb ping
78       </p><p>
79         Example output:
80       </p><pre class="screen">
81 response from 0 time=0.000054 sec  (3 clients)
82 response from 1 time=0.000144 sec  (2 clients)
83 response from 2 time=0.000105 sec  (2 clients)
84 response from 3 time=0.000114 sec  (2 clients)
85       </pre></div><div class="refsect2" lang="en"><a name="id2481310"></a><h3>ip</h3><p>
86         This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip.
87       </p><p>
88         Example: ctdb ip
89       </p><p>
90         Example output:
91       </p><pre class="screen">
92 Number of nodes:4
93 12.1.1.1         0
94 12.1.1.2         1
95 12.1.1.3         2
96 12.1.1.4         3
97       </pre></div><div class="refsect2" lang="en"><a name="id2481336"></a><h3>getvar &lt;name&gt;</h3><p>
98         Get the runtime value of a tuneable variable.
99       </p><p>
100         Example: ctdb getvar MaxRedirectCount
101       </p><p>
102         Example output:
103       </p><pre class="screen">
104 MaxRedirectCount    = 3
105       </pre></div><div class="refsect2" lang="en"><a name="id2528417"></a><h3>setvar &lt;name&gt; &lt;value&gt;</h3><p>
106         Set the runtime value of a tuneable variable.
107       </p><p>
108         Example: ctdb setvar MaxRedirectCount 5
109       </p></div><div class="refsect2" lang="en"><a name="id2528432"></a><h3>listvars</h3><p>
110         List all tuneable variables.
111       </p><p>
112         Example: ctdb listvars
113       </p><p>
114         Example output:
115       </p><pre class="screen">
116 MaxRedirectCount    = 5
117 SeqnumFrequency     = 1
118 ControlTimeout      = 60
119 TraverseTimeout     = 20
120 KeepaliveInterval   = 2
121 KeepaliveLimit      = 3
122 MaxLACount          = 7
123 RecoverTimeout      = 5
124 RecoverInterval     = 1
125 ElectionTimeout     = 3
126 TakeoverTimeout     = 5
127 MonitorInterval     = 15
128 EventScriptTimeout  = 20
129 RecoveryGracePeriod = 60
130 RecoveryBanPeriod   = 300
131       </pre></div><div class="refsect2" lang="en"><a name="id2528460"></a><h3>statistics</h3><p>
132         Collect statistics from the CTDB daemon about how many calls it has served.
133       </p><p>
134         Example: ctdb statistics
135       </p><p>
136         Example output:
137       </p><pre class="screen">
138 CTDB version 1
139  num_clients                        3
140  frozen                             0
141  recovering                         0
142  client_packets_sent           360489
143  client_packets_recv           360466
144  node_packets_sent             480931
145  node_packets_recv             240120
146  keepalive_packets_sent             4
147  keepalive_packets_recv             3
148  node
149      req_call                       2
150      reply_call                     2
151      req_dmaster                    0
152      reply_dmaster                  0
153      reply_error                    0
154      req_message                   42
155      req_control               120408
156      reply_control             360439
157  client
158      req_call                       2
159      req_message                   24
160      req_control               360440
161  timeouts
162      call                           0
163      control                        0
164      traverse                       0
165  total_calls                        2
166  pending_calls                      0
167  lockwait_calls                     0
168  pending_lockwait_calls             0
169  memory_used                     5040
170  max_hop_count                      0
171  max_call_latency                   4.948321 sec
172  max_lockwait_latency               0.000000 sec
173       </pre></div><div class="refsect2" lang="en"><a name="id2528504"></a><h3>statisticsreset</h3><p>
174         This command is used to clear all statistics counters in a node.
175       </p><p>
176         Example: ctdb statisticsreset
177       </p></div><div class="refsect2" lang="en"><a name="id2528518"></a><h3>getdebug</h3><p>
178         Get the current debug level for the node. the debug level controls what information is written to the log file.
179       </p></div><div class="refsect2" lang="en"><a name="id2528529"></a><h3>setdebug &lt;debuglevel&gt;</h3><p>
180         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.
181       </p></div><div class="refsect2" lang="en"><a name="id2528541"></a><h3>getpid</h3><p>
182         This command will return the process id of the ctdb daemon.
183       </p></div><div class="refsect2" lang="en"><a name="id2528551"></a><h3>disable</h3><p>
184         This command is used to administratively disable a node in the cluster.
185         A disabled node will still participate in the cluster and host
186         clustered TDB records but its public ip address has been taken over by
187         a different node and it no longer hosts any services.
188       </p></div><div class="refsect2" lang="en"><a name="id2528565"></a><h3>enable</h3><p>
189         Re-enable a node that has been administratively disabled.
190       </p></div><div class="refsect2" lang="en"><a name="id2528575"></a><h3>ban &lt;bantime|0&gt;</h3><p>
191         Administratively ban a node for bantime seconds. A bantime of 0 means that the node should be permanently banned. 
192       </p><p>
193         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.
194       </p><p>
195         Nodes are automatically banned if they are the cause of too many
196         cluster recoveries.
197       </p></div><div class="refsect2" lang="en"><a name="id2528598"></a><h3>unban</h3><p>
198         This command is used to unban a node that has either been 
199         administratively banned using the ban command or has been automatically
200         banned by the recovery daemon.
201       </p></div><div class="refsect2" lang="en"><a name="id2528610"></a><h3>shutdown</h3><p>
202         This command will shutdown a specific CTDB daemon.
203       </p></div><div class="refsect2" lang="en"><a name="id2528620"></a><h3>recover</h3><p>
204         This command will trigger the recovery daemon to do a cluster
205         recovery.
206       </p></div><div class="refsect2" lang="en"><a name="id2528631"></a><h3>killtcp &lt;srcip:port&gt; &lt;dstip:port&gt;</h3><p>
207         This command will kill the specified TCP connection by issuing a
208         TCP RST to the srcip:port endpoint.
209       </p></div><div class="refsect2" lang="en"><a name="id2528642"></a><h3>tickle &lt;srcip:port&gt; &lt;dstip:port&gt;</h3><p>
210         This command will will send a TCP tickle to the source host for the
211         specified TCP connection.
212         A TCP tickle is a TCP ACK packet with an invalid sequence and 
213         acknowledge number and will when received by the source host result
214         in it sending an immediate correct ACK back to the other end.
215       </p><p>
216         TCP tickles are useful to "tickle" clients after a IP failover has 
217         occured since this will make the client immediately recognize the 
218         TCP connection has been disrupted and that the client will need
219         to reestablish. This greatly speeds up the time it takes for a client
220         to detect and reestablish after an IP failover in the ctdb cluster.
221       </p></div></div><div class="refsect1" lang="en"><a name="id2528668"></a><h2>Debugging Commands</h2><p>
222       These commands are primarily used for CTDB development and testing and
223       should not be used for normal administration.
224     </p><div class="refsect2" lang="en"><a name="id2528679"></a><h3>process-exists &lt;pid&gt;</h3><p>
225         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.
226       </p></div><div class="refsect2" lang="en"><a name="id2528691"></a><h3>getdbmap</h3><p>
227         This command lists all clustered TDB databases that the CTDB daemon has attahced to.
228       </p><p>
229         Example: ctdb getdbmap
230       </p><p>
231         Example output:
232       </p><pre class="screen">
233 Number of databases:4
234 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0
235 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0
236 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0
237 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0
238       </pre></div><div class="refsect2" lang="en"><a name="id2528718"></a><h3>catdb &lt;dbname&gt;</h3><p>
239         This command will dump a clustered TDB database to the screen. This is a debugging command.
240       </p></div><div class="refsect2" lang="en"><a name="id2528729"></a><h3>getmonmode</h3><p>
241         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.
242       </p><p>
243         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.
244       </p><p>
245         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.
246       </p></div><div class="refsect2" lang="en"><a name="id2528760"></a><h3>setmonmode &lt;0|1&gt;</h3><p>
247         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.
248       </p></div><div class="refsect2" lang="en"><a name="id2528776"></a><h3>attach &lt;dbname&gt;</h3><p>
249         This is a debugging command. This command will make the CTDB daemon create a new CTDB database and attach to it.
250       </p></div><div class="refsect2" lang="en"><a name="id2528787"></a><h3>dumpmemory</h3><p>
251         This is a debugging command. This command will make the ctdb daemon to write a fill memory allocation map to the log file.
252       </p></div><div class="refsect2" lang="en"><a name="id2528798"></a><h3>freeze</h3><p>
253         This command will lock all the local TDB databases causing clients 
254         that are accessing these TDBs such as samba3 to block until the
255         databases are thawed.
256       </p><p>
257         This is primarily used by the recovery daemon to stop all samba
258         daemons from accessing any databases while the database is recovered
259         and rebuilt.
260       </p></div><div class="refsect2" lang="en"><a name="id2528816"></a><h3>thaw</h3><p>
261         Thaw a previously frozen node.
262       </p></div></div><div class="refsect1" lang="en"><a name="id2528827"></a><h2>SEE ALSO</h2><p>
263       ctdbd(1), onnode(1)
264       <a href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
265     </p></div><div class="refsect1" lang="en"><a name="id2528840"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
266 Copyright (C) Andrew Tridgell 2007<br>
267 Copyright (C) Ronnie sahlberg 2007<br>
268 <br>
269 This program is free software; you can redistribute it and/or modify<br>
270 it under the terms of the GNU General Public License as published by<br>
271 the Free Software Foundation; either version 3 of the License, or (at<br>
272 your option) any later version.<br>
273 <br>
274 This program is distributed in the hope that it will be useful, but<br>
275 WITHOUT ANY WARRANTY; without even the implied warranty of<br>
276 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU<br>
277 General Public License for more details.<br>
278 <br>
279 You should have received a copy of the GNU General Public License<br>
280 along with this program; if not, see http://www.gnu.org/licenses/.<br>
281 </p></div></div></div></body></html>