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 — 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 <node>] [-Y] [-t <timeout>] [-? --help] [--usage] [-d --debug=<INTEGER>] [--socket=<filename>]</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 <vnn></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
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 <timeout></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=<debuglevel></span></dt><dd><p>
19 Change the debug level for the command. Default is 0.
20 </p></dd><dt><span class="term">--socket=<filename></span></dt><dd><p>
21 Specify the socketname to use when connecting to the local ctdb
22 daemon. The default is /tmp/ctdb.socket .
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:
34 OK - This node is fully functional.
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.
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.
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.
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:
53 NORMAL - The cluster is fully operational.
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.
60 </p><p>Example output:</p><pre class="screen">
62 vnn:0 11.1.2.200 OK (THIS NODE)
72 Recovery mode:NORMAL (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.
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.
91 </p><pre class="screen">
97 </pre></div><div class="refsect2" lang="en"><a name="id2481336"></a><h3>getvar <name></h3><p>
98 Get the runtime value of a tuneable variable.
100 Example: ctdb getvar MaxRedirectCount
103 </p><pre class="screen">
105 </pre></div><div class="refsect2" lang="en"><a name="id2528417"></a><h3>setvar <name> <value></h3><p>
106 Set the runtime value of a tuneable variable.
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.
112 Example: ctdb listvars
115 </p><pre class="screen">
120 KeepaliveInterval = 2
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.
134 Example: ctdb statistics
137 </p><pre class="screen">
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
168 pending_lockwait_calls 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.
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 <debuglevel></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 <bantime|0></h3><p>
191 Administratively ban a node for bantime seconds. A bantime of 0 means that the node should be permanently banned.
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.
195 Nodes are automatically banned if they are the cause of too many
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
206 </p></div><div class="refsect2" lang="en"><a name="id2528631"></a><h3>killtcp <srcip:port> <dstip:port></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 <srcip:port> <dstip:port></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.
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 <pid></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.
229 Example: ctdb getdbmap
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 <dbname></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.
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.
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 <0|1></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 <dbname></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.
257 This is primarily used by the recovery daemon to stop all samba
258 daemons from accessing any databases while the database is recovered
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>
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>
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>
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>
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>