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 — 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="id2488862"></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="id2488872"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-n <node></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 <timeout></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=<debuglevel></span></dt><dd><p>
15 Change the debug level for the command. Default is 0.
16 </p></dd><dt><span class="term">--socket=<filename></span></dt><dd><p>
17 Specify the socketname to use when connecting to the local ctdb
18 daemon. The default is /tmp/ctdb.socket .
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="id2488987"></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="id2488996"></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="id2489005"></a><h4>node status</h4><p>
28 Node status reflects the current status of the node. There are four possible states:
30 OK - This node is fully functional.
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.
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.
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.
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="id2489056"></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="id2490202"></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="id2490216"></a><h4>Recovery mode</h4><p>
47 This is the current recovery mode of the cluster. There are two possible modes:
49 NORMAL - The cluster is fully operational.
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="id2490240"></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.
56 </p><p>Example output:</p><pre class="screen">
58 vnn:0 11.1.2.200 OK (THIS NODE)
68 Recovery mode:NORMAL (0)
70 </pre></div><div class="refsect2" lang="en"><a name="id2490271"></a><h3>ping</h3><p>
71 This command will "ping" all CTDB daemons in the cluster to verify that they are processing commands correctly.
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="id2490297"></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.
87 </p><pre class="screen">
93 </pre></div><div class="refsect2" lang="en"><a name="id2490322"></a><h3>getvar <name></h3><p>
94 Get the runtime value of a tuneable variable.
96 Example: ctdb getvar MaxRedirectCount
99 </p><pre class="screen">
101 </pre></div><div class="refsect2" lang="en"><a name="id2490345"></a><h3>setvar <name> <value></h3><p>
102 Set the runtime value of a tuneable variable.
104 Example: ctdb setvar MaxRedirectCount 5
105 </p></div><div class="refsect2" lang="en"><a name="id2490360"></a><h3>listvars</h3><p>
106 List all tuneable variables.
108 Example: ctdb listvars
111 </p><pre class="screen">
116 KeepaliveInterval = 2
124 EventScriptTimeout = 20
125 RecoveryGracePeriod = 60
126 RecoveryBanPeriod = 300
127 </pre></div><div class="refsect2" lang="en"><a name="id2490388"></a><h3>statistics</h3><p>
128 Collect statistics from the CTDB daemon about how many calls it has served.
130 Example: ctdb statistics
133 </p><pre class="screen">
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
164 pending_lockwait_calls 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="id2490432"></a><h3>statisticsreset</h3><p>
170 This command is used to clear all statistics counters in a node.
172 Example: ctdb statisticsreset
173 </p></div><div class="refsect2" lang="en"><a name="id2490445"></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="id2490456"></a><h3>setdebug <debuglevel></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="id2536582"></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="id2536592"></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="id2536611"></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="id2536621"></a><h3>ban <bantime|0></h3><p>
187 Administratively ban a node for bantime seconds. A bantime of 0 means that the node should be permanently banned.
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.
191 Nodes are automatically banned if they are the cause of too many
193 </p></div><div class="refsect2" lang="en"><a name="id2536645"></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="id2536657"></a><h3>shutdown</h3><p>
198 This command will shutdown a specific CTDB daemon.
199 </p></div><div class="refsect2" lang="en"><a name="id2536667"></a><h3>recover</h3><p>
200 This command will trigger the recovery daemon to do a cluster
202 </p></div><div class="refsect2" lang="en"><a name="id2536677"></a><h3>killtcp <srcip:port> <dstip:port></h3><p>
203 This command will kill the specified TCP connection by issuing a
204 TCP RST to the srcip:port endpoint.
205 </p></div><div class="refsect2" lang="en"><a name="id2536689"></a><h3>tickle <srcip:port> <dstip:port></h3><p>
206 This command will will send a TCP tickle to the source host for the
207 specified TCP connection.
208 A TCP tickle is a TCP ACK packet with an invalid sequence and
209 acknowledge number and will when received by the source host result
210 in it sending an immediate correct ACK back to the other end.
212 TCP tickles are useful to "tickle" clients after a IP failover has
213 occured since this will make the client immediately recognize the
214 TCP connection has been disrupted and that the client will need
215 to reestablish. This greatly speeds up the time it takes for a client
216 to detect and reestablish after an IP failover in the ctdb cluster.
217 </p></div></div><div class="refsect1" lang="en"><a name="id2536715"></a><h2>Debugging Commands</h2><p>
218 These commands are primarily used for CTDB development and testing and
219 should not be used for normal administration.
220 </p><div class="refsect2" lang="en"><a name="id2536725"></a><h3>process-exists <pid></h3><p>
221 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.
222 </p></div><div class="refsect2" lang="en"><a name="id2536737"></a><h3>getdbmap</h3><p>
223 This command lists all clustered TDB databases that the CTDB daemon has attahced to.
225 Example: ctdb getdbmap
228 </p><pre class="screen">
229 Number of databases:4
230 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0
231 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0
232 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0
233 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0
234 </pre></div><div class="refsect2" lang="en"><a name="id2536764"></a><h3>catdb <dbname></h3><p>
235 This command will dump a clustered TDB database to the screen. This is a debugging command.
236 </p></div><div class="refsect2" lang="en"><a name="id2536775"></a><h3>getmonmode</h3><p>
237 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.
239 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.
241 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.
242 </p></div><div class="refsect2" lang="en"><a name="id2536806"></a><h3>setmonmode <0|1></h3><p>
243 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.
244 </p></div><div class="refsect2" lang="en"><a name="id2536821"></a><h3>attach <dbname></h3><p>
245 This is a debugging command. This command will make the CTDB daemon create a new CTDB database and attach to it.
246 </p></div><div class="refsect2" lang="en"><a name="id2536832"></a><h3>dumpmemory</h3><p>
247 This is a debugging command. This command will make the ctdb daemon to write a fill memory allocation map to the log file.
248 </p></div><div class="refsect2" lang="en"><a name="id2536844"></a><h3>freeze</h3><p>
249 This command will lock all the local TDB databases causing clients
250 that are accessing these TDBs such as samba3 to block until the
251 databases are thawed.
253 This is primarily used by the recovery daemon to stop all samba
254 daemons from accessing any databases while the database is recovered
256 </p></div><div class="refsect2" lang="en"><a name="id2536862"></a><h3>thaw</h3><p>
257 Thaw a previously frozen node.
258 </p></div></div><div class="refsect1" lang="en"><a name="id2536873"></a><h2>SEE ALSO</h2><p>
260 <a href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
261 </p></div><div class="refsect1" lang="en"><a name="id2536886"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
262 Copyright (C) Andrew Tridgell 2007<br>
263 Copyright (C) Ronnie sahlberg 2007<br>
265 This program is free software; you can redistribute it and/or modify<br>
266 it under the terms of the GNU General Public License as published by<br>
267 the Free Software Foundation; either version 2 of the License, or (at<br>
268 your option) any later version.<br>
270 This program is distributed in the hope that it will be useful, but<br>
271 WITHOUT ANY WARRANTY; without even the implied warranty of<br>
272 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br>
273 General Public License for more details.<br>
275 You should have received a copy of the GNU General Public License<br>
276 along with this program; if not, write to the Free Software<br>
277 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.<br>
278 </p></div></div></div></body></html>