merge from tridge
[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.72.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="id2488867"></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="id2488877"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-n &lt;node&gt;</span></dt><dd><p>
4             This specifies on which node to execute the command. Default is
5             to run the command on the deamon running on the local host.
6           </p></dd><dt><span class="term">-Y</span></dt><dd><p>
7             Produce output in machinereadable form for easier parsing by scripts. Not all commands support this option.
8           </p></dd><dt><span class="term">-t &lt;timeout&gt;</span></dt><dd><p>
9             How long should ctdb wait for a command to complete before timing out. Default is 3 seconds.
10           </p></dd><dt><span class="term">-? --help</span></dt><dd><p>
11             Print some help text to the screen.
12           </p></dd><dt><span class="term">--usage</span></dt><dd><p>
13             Print useage information to the screen.
14           </p></dd><dt><span class="term">-d --debug=&lt;debuglevel&gt;</span></dt><dd><p>
15             Change the debug level for the command. Default is 0.
16           </p></dd><dt><span class="term">--socket=&lt;filename&gt;</span></dt><dd><p>
17             Specify the socketname to use when connecting to the local ctdb 
18             daemon. The default is /tmp/ctdb.socket .
19           </p><p>
20             You only need to specify this parameter if you run multiple ctdb 
21             daemons on the same physical host and thus can not use the default
22             name for the domain socket.
23           </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2488991"></a><h2>Administrative Commands</h2><p>
24       These are commands used to monitor and administrate a CTDB cluster.
25     </p><div class="refsect2" lang="en"><a name="id2489000"></a><h3>status</h3><p>
26         This command shows the current status of the ctdb node.
27       </p><div class="refsect3" lang="en"><a name="id2489009"></a><h4>node status</h4><p>
28           Node status reflects the current status of the node. There are four possible states:
29         </p><p>
30           OK - This node is fully functional.
31         </p><p>
32           DISCONNECTED - This node could not be connected through the network and is currently not parcipitating 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.
33         </p><p>
34           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.
35         </p><p>
36           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.
37         </p><p>
38           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.
39         </p></div><div class="refsect3" lang="en"><a name="id2489061"></a><h4>generation</h4><p>
40           The generation id is a number that indicates the current generation 
41           of a cluster instance. Each time a cluster goes through a 
42           reconfiguration or a recovery its generation id will be changed.
43         </p></div><div class="refsect3" lang="en"><a name="id2490207"></a><h4>VNNMAP</h4><p>
44           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.
45           Only nodes that are parcipitating in the vnnmap can become lmaster or dmaster for a database record.
46         </p></div><div class="refsect3" lang="en"><a name="id2490221"></a><h4>Recovery mode</h4><p>
47           This is the current recovery mode of the cluster. There are two possible modes:
48         </p><p>
49           NORMAL - The cluster is fully operational.
50         </p><p>
51           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.
52         </p></div><div class="refsect3" lang="en"><a name="id2490244"></a><h4>Recovery master</h4><p>
53           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.
54         </p></div><p>
55         Example: ctdb status
56       </p><p>Example output:</p><pre class="screen">
57 Number of nodes:4
58 vnn:0 11.1.2.200       OK (THIS NODE)
59 vnn:1 11.1.2.201       OK
60 vnn:2 11.1.2.202       OK
61 vnn:3 11.1.2.203       OK
62 Generation:1362079228
63 Size:4
64 hash:0 lmaster:0
65 hash:1 lmaster:1
66 hash:2 lmaster:2
67 hash:3 lmaster:3
68 Recovery mode:NORMAL (0)
69 Recovery master:0
70       </pre></div><div class="refsect2" lang="en"><a name="id2490275"></a><h3>ping</h3><p>
71         This command will "ping" all CTDB daemons in the cluster to verify that they are processing commands correctly.
72       </p><p>
73         Example: ctdb ping
74       </p><p>
75         Example output:
76       </p><pre class="screen">
77 response from 0 time=0.000054 sec  (3 clients)
78 response from 1 time=0.000144 sec  (2 clients)
79 response from 2 time=0.000105 sec  (2 clients)
80 response from 3 time=0.000114 sec  (2 clients)
81       </pre></div><div class="refsect2" lang="en"><a name="id2490302"></a><h3>ip</h3><p>
82         This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip.
83       </p><p>
84         Example: ctdb ip
85       </p><p>
86         Example output:
87       </p><pre class="screen">
88 Number of nodes:4
89 12.1.1.1         0
90 12.1.1.2         1
91 12.1.1.3         2
92 12.1.1.4         3
93       </pre></div><div class="refsect2" lang="en"><a name="id2490327"></a><h3>getvar &lt;name&gt;</h3><p>
94         Get the runtime value of a tuneable variable.
95       </p><p>
96         Example: ctdb getvar MaxRedirectCount
97       </p><p>
98         Example output:
99       </p><pre class="screen">
100 MaxRedirectCount    = 3
101       </pre></div><div class="refsect2" lang="en"><a name="id2490350"></a><h3>setvar &lt;name&gt; &lt;value&gt;</h3><p>
102         Set the runtime value of a tuneable variable.
103       </p><p>
104         Example: ctdb setvar MaxRedirectCount 5
105       </p></div><div class="refsect2" lang="en"><a name="id2490365"></a><h3>listvars</h3><p>
106         List all tuneable variables.
107       </p><p>
108         Example: ctdb listvars
109       </p><p>
110         Example output:
111       </p><pre class="screen">
112 MaxRedirectCount    = 5
113 SeqnumFrequency     = 1
114 ControlTimeout      = 60
115 TraverseTimeout     = 20
116 KeepaliveInterval   = 2
117 KeepaliveLimit      = 3
118 MaxLACount          = 7
119 RecoverTimeout      = 5
120 RecoverInterval     = 1
121 ElectionTimeout     = 3
122 TakeoverTimeout     = 5
123 MonitorInterval     = 15
124 EventScriptTimeout  = 20
125 RecoveryGracePeriod = 60
126 RecoveryBanPeriod   = 300
127       </pre></div><div class="refsect2" lang="en"><a name="id2490393"></a><h3>statistics</h3><p>
128         Collect statistics from the CTDB daemon about how many calls it has served.
129       </p><p>
130         Example: ctdb statistics
131       </p><p>
132         Example output:
133       </p><pre class="screen">
134 CTDB version 1
135  num_clients                        3
136  frozen                             0
137  recovering                         0
138  client_packets_sent           360489
139  client_packets_recv           360466
140  node_packets_sent             480931
141  node_packets_recv             240120
142  keepalive_packets_sent             4
143  keepalive_packets_recv             3
144  node
145      req_call                       2
146      reply_call                     2
147      req_dmaster                    0
148      reply_dmaster                  0
149      reply_error                    0
150      req_message                   42
151      req_control               120408
152      reply_control             360439
153  client
154      req_call                       2
155      req_message                   24
156      req_control               360440
157  timeouts
158      call                           0
159      control                        0
160      traverse                       0
161  total_calls                        2
162  pending_calls                      0
163  lockwait_calls                     0
164  pending_lockwait_calls             0
165  memory_used                     5040
166  max_hop_count                      0
167  max_call_latency                   4.948321 sec
168  max_lockwait_latency               0.000000 sec
169       </pre></div><div class="refsect2" lang="en"><a name="id2490436"></a><h3>statisticsreset</h3><p>
170         This command is used to clear all statistics counters in a node.
171       </p><p>
172         Example: ctdb statisticsreset
173       </p></div><div class="refsect2" lang="en"><a name="id2490450"></a><h3>getdebug</h3><p>
174         Get the current debug level for the node. the debug level controls what information is written to the log file.
175       </p></div><div class="refsect2" lang="en"><a name="id2490461"></a><h3>setdebug &lt;debuglevel&gt;</h3><p>
176         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.
177       </p></div><div class="refsect2" lang="en"><a name="id2536585"></a><h3>getpid</h3><p>
178         This command will return the process id of the ctdb daemon.
179       </p></div><div class="refsect2" lang="en"><a name="id2536595"></a><h3>disable</h3><p>
180         This command is used to administratively disable a node in the cluster.
181         A disabled node will still participate in the cluster and host
182         clustered TDB records but its public ip address has been taken over by
183         a different node and it no longer hosts any services.
184       </p></div><div class="refsect2" lang="en"><a name="id2536613"></a><h3>enable</h3><p>
185         Re-enable a node that has been administratively disabled.
186       </p></div><div class="refsect2" lang="en"><a name="id2536623"></a><h3>ban &lt;bantime|0&gt;</h3><p>
187         Administratively ban a node for bantime seconds. A bantime of 0 means that the node should be permanently banned. 
188       </p><p>
189         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.
190       </p><p>
191         Nodes are automatically banned if they are the cause of too many
192         cluster recoveries.
193       </p></div><div class="refsect2" lang="en"><a name="id2536646"></a><h3>unban</h3><p>
194         This command is used to unban a node that has either been 
195         administratively banned using the ban command or has been automatically
196         banned by the recovery daemon.
197       </p></div><div class="refsect2" lang="en"><a name="id2536658"></a><h3>shutdown</h3><p>
198         This command will shutdown a specific CTDB daemon.
199       </p></div><div class="refsect2" lang="en"><a name="id2536668"></a><h3>recover</h3><p>
200         This command will trigger the recovery daemon to do a cluster
201         recovery.
202       </p></div></div><div class="refsect1" lang="en"><a name="id2536680"></a><h2>Debugging Commands</h2><p>
203       These commands are primarily used for CTDB development and testing and
204       should not be used for normal administration.
205     </p><div class="refsect2" lang="en"><a name="id2536690"></a><h3>process-exists &lt;pid&gt;</h3><p>
206         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.
207       </p></div><div class="refsect2" lang="en"><a name="id2536702"></a><h3>getdbmap</h3><p>
208         This command lists all clustered TDB databases that the CTDB daemon has attahced to.
209       </p><p>
210         Example: ctdb getdbmap
211       </p><p>
212         Example output:
213       </p><pre class="screen">
214 Number of databases:4
215 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0
216 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0
217 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0
218 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0
219       </pre></div><div class="refsect2" lang="en"><a name="id2536730"></a><h3>catdb &lt;dbname&gt;</h3><p>
220         This command will dump a clustered TDB database to the screen. This is a debugging command.
221       </p></div><div class="refsect2" lang="en"><a name="id2536740"></a><h3>getmonmode</h3><p>
222         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.
223       </p><p>
224         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.
225       </p><p>
226         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.
227       </p></div><div class="refsect2" lang="en"><a name="id2536771"></a><h3>setmonmode &lt;0|1&gt;</h3><p>
228         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.
229       </p></div><div class="refsect2" lang="en"><a name="id2536794"></a><h3>attach &lt;dbname&gt;</h3><p>
230         This is a debugging command. This command will make the CTDB daemon create a new CTDB database and attach to it.
231       </p></div><div class="refsect2" lang="en"><a name="id2536805"></a><h3>dumpmemory</h3><p>
232         This is a debugging command. This command will make the ctdb daemon to write a fill memory allocation map to the log file.
233       </p></div><div class="refsect2" lang="en"><a name="id2536816"></a><h3>freeze</h3><p>
234         This command will lock all the local TDB databases causing clients 
235         that are accessing these TDBs such as samba3 to block until the
236         databases are thawed.
237       </p><p>
238         This is primarily used by the recovery daemon to stop all samba
239         daemons from accessing any databases while the database is recovered
240         and rebuilt.
241       </p></div><div class="refsect2" lang="en"><a name="id2536834"></a><h3>thaw</h3><p>
242         Thaw a previously frozen node.
243       </p></div></div><div class="refsect1" lang="en"><a name="id2536845"></a><h2>SEE ALSO</h2><p>
244       ctdbd(1), onnode(1)
245       <a href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
246     </p></div><div class="refsect1" lang="en"><a name="id2536858"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
247 Copyright (C) Andrew Tridgell 2007<br>
248 Copyright (C) Ronnie sahlberg 2007<br>
249 <br>
250 This program is free software; you can redistribute it and/or modify<br>
251 it under the terms of the GNU General Public License as published by<br>
252 the Free Software Foundation; either version 2 of the License, or (at<br>
253 your option) any later version.<br>
254 <br>
255 This program is distributed in the hope that it will be useful, but<br>
256 WITHOUT ANY WARRANTY; without even the implied warranty of<br>
257 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU<br>
258 General Public License for more details.<br>
259 <br>
260 You should have received a copy of the GNU General Public License<br>
261 along with this program; if not, write to the Free Software<br>
262 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.<br>
263 </p></div></div></div></body></html>