3 .\" Generator: DocBook XSL Stylesheets v1.71.0 <http://docbook.sf.net/>
8 .TH "CTDB" "1" "02/05/2008" "" ""
9 .\" disable hyphenation
11 .\" disable justification (adjust text to left margin only)
14 ctdb \- clustered tdb database management utility
17 \fBctdb [ OPTIONS ] COMMAND ...\fR
19 \fBctdb\fR [\-n\ <node>] [\-Y] [\-t\ <timeout>] [\-T\ <timelimit>] [\-?\ \-\-help] [\-\-usage] [\-d\ \-\-debug=<INTEGER>] [\-\-socket=<filename>]
22 ctdb is a utility to view and manage a ctdb cluster.
27 This specifies the physical node number on which to execute the command. Default is to run the command on the deamon running on the local host.
29 The physical node number is an integer that describes the node in the cluster. The first node has physical node number 0.
34 Produce output in machine readable form for easier parsing by scripts. Not all commands support this option.
39 How long should ctdb wait for the local ctdb daemon to respond to a command before timing out. Default is 3 seconds.
44 A limit on how long the ctdb command will run for before it will be aborted. When this timelimit has been exceeded the ctdb command will terminate.
49 Print some help text to the screen.
54 Print useage information to the screen.
57 \-d \-\-debug=<debuglevel>
59 Change the debug level for the command. Default is 0.
64 Specify the socketname to use when connecting to the local ctdb daemon. The default is /tmp/ctdb.socket .
66 You only need to specify this parameter if you run multiple ctdb daemons on the same physical host and thus can not use the default name for the domain socket.
68 .SH "ADMINISTRATIVE COMMANDS"
70 These are commands used to monitor and administrate a CTDB cluster.
73 This command shows the current status of the ctdb node.
76 .nr an-no-space-flag 1
82 Node status reflects the current status of the node. There are four possible states:
84 OK \- This node is fully functional.
86 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.
88 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.
90 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.
92 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.
96 .nr an-no-space-flag 1
102 The generation id is a number that indicates the current generation of a cluster instance. Each time a cluster goes through a reconfiguration or a recovery its generation id will be changed.
104 This number does not have any particular meaning other than to keep track of when a cluster has gone through a recovery. It is a random number that represents the current instance of a ctdb cluster and its databases. CTDBD uses this number internally to be able to tell when commands to operate on the cluster and the databases was issued in a different generation of the cluster, to ensure that commands that operate on the databases will not survive across a cluster database recovery. After a recovery, all old outstanding commands will automatically become invalid.
106 Sometimes this number will be shown as "INVALID". This only means that the ctdbd daemon has started but it has not yet merged with the cluster through a recovery. All nodes start with generation "INVALID" and are not assigned a real generation id until they have successfully been merged with a cluster through a recovery.
110 .nr an-no-space-flag 1
116 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. Only nodes that are participating in the vnnmap can become lmaster or dmaster for a database record.
120 .nr an-no-space-flag 1
126 This is the current recovery mode of the cluster. There are two possible modes:
128 NORMAL \- The cluster is fully operational.
130 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.
132 Once the recovery master detects an inconsistency, for example a node becomes disconnected/connected, the recovery daemon will trigger a cluster recovery process, where all databases are remerged across the cluster. When this process starts, the recovery master will first "freeze" all databases to prevent applications such as samba from accessing the databases and it will also mark the recovery mode as RECOVERY.
134 When CTDBD starts up, it will start in RECOVERY mode. Once the node has been merged into a cluster and all databases have been recovered, the node mode will change into NORMAL mode and the databases will be "thawed", allowing samba to access the databases again.
138 .nr an-no-space-flag 1
141 \fBRecovery master\fR
144 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.
146 Only one node at a time can be the designated recovery master. Which node is designated the recovery master is decided by an election process in the recovery daemons running on each node.
156 pnn:0 11.1.2.200 OK (THIS NODE)
160 Generation:1362079228
166 Recovery mode:NORMAL (0)
173 This command will "ping" all CTDB daemons in the cluster to verify that they are processing commands correctly.
181 response from 0 time=0.000054 sec (3 clients)
182 response from 1 time=0.000144 sec (2 clients)
183 response from 2 time=0.000105 sec (2 clients)
184 response from 3 time=0.000114 sec (2 clients)
190 This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip.
198 Number of addresses:4
208 Get the runtime value of a tuneable variable.
210 Example: ctdb getvar MaxRedirectCount
220 .SS "setvar <name> <value>"
222 Set the runtime value of a tuneable variable.
224 Example: ctdb setvar MaxRedirectCount 5
227 List all tuneable variables.
229 Example: ctdb listvars
239 KeepaliveInterval = 2
247 EventScriptTimeout = 20
248 RecoveryGracePeriod = 60
249 RecoveryBanPeriod = 300
255 Collect statistics from the CTDB daemon about how many calls it has served.
257 Example: ctdb statistics
267 client_packets_sent 360489
268 client_packets_recv 360466
269 node_packets_sent 480931
270 node_packets_recv 240120
271 keepalive_packets_sent 4
272 keepalive_packets_recv 3
293 pending_lockwait_calls 0
296 max_call_latency 4.948321 sec
297 max_lockwait_latency 0.000000 sec
301 .SS "statisticsreset"
303 This command is used to clear all statistics counters in a node.
305 Example: ctdb statisticsreset
308 Get the current debug level for the node. the debug level controls what information is written to the log file.
310 The debug levels are mapped to the corresponding syslog levels. When a debug level is set, only those messages at that level and higher levels will be printed.
312 The list of debug levels from highest to lowest are :
314 EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
315 .SS "setdebug <debuglevel>"
317 Set the debug level of a node. This controls what information will be logged.
319 The debuglevel is one of EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
322 This command will return the process id of the ctdb daemon.
325 This command is used to administratively disable a node in the cluster. A disabled node will still participate in the cluster and host clustered TDB records but its public ip address has been taken over by a different node and it no longer hosts any services.
328 Re\-enable a node that has been administratively disabled.
329 .SS "ban <bantime|0>"
331 Administratively ban a node for bantime seconds. A bantime of 0 means that the node should be permanently banned.
333 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.
335 Nodes are automatically banned if they are the cause of too many cluster recoveries.
338 This command is used to unban a node that has either been administratively banned using the ban command or has been automatically banned by the recovery daemon.
341 This command will shutdown a specific CTDB daemon.
344 This command will trigger the recovery daemon to do a cluster recovery.
345 .SS "killtcp <srcip:port> <dstip:port>"
347 This command will kill the specified TCP connection by issuing a TCP RST to the srcip:port endpoint.
348 .SS "tickle <srcip:port> <dstip:port>"
350 This command will will send a TCP tickle to the source host for the specified TCP connection. A TCP tickle is a TCP ACK packet with an invalid sequence and acknowledge number and will when received by the source host result in it sending an immediate correct ACK back to the other end.
352 TCP tickles are useful to "tickle" clients after a IP failover has occured since this will make the client immediately recognize the TCP connection has been disrupted and that the client will need to reestablish. This greatly speeds up the time it takes for a client to detect and reestablish after an IP failover in the ctdb cluster.
353 .SS "repack [max_freelist]"
355 Over time, when records are created and deleted in a TDB, the TDB list of free space will become fragmented. This can lead to a slowdown in accessing TDB records. This command is used to defragment a TDB database and pruning the freelist.
357 If [max_freelist] is specified, then a database will only be repacked if it has more than this number of entries in the freelist.
359 During repacking of the database, the entire TDB database will be locked to prevent writes. If samba tries to write to a record in the database during a repack operation, samba will block until the repacking has completed.
361 This command can be disruptive and can cause samba to block for the duration of the repack operation. In general, a repack operation will take less than one second to complete.
363 A repack operation will only defragment the local TDB copy of the CTDB database. You need to run this command on all of the nodes to repack a CTDB database completely.
365 Example: ctdb repack 1000
367 By default, this operation is issued from the 00.ctdb event script every 5 minutes.
368 .SS "vacuum [max_records]"
370 Over time CTDB databases will fill up with empty deleted records which will lead to a progressive slow down of CTDB database access. This command is used to prune all databases and delete all empty records from the cluster.
372 By default, vacuum will delete all empty records from all databases. If [max_records] is specified, the command will only delete the first [max_records] empty records for each database.
374 Vacuum only deletes records where the local node is the lmaster. To delete all records from the entire cluster you need to run a vacuum from each node. This command is not disruptive. Samba is unaffected and will still be able to read/write records normally while the database is being vacuumed.
378 By default, this operation is issued from the 00.ctdb event script every 5 minutes.
379 .SH "DEBUGGING COMMANDS"
381 These commands are primarily used for CTDB development and testing and should not be used for normal administration.
382 .SS "process\-exists <pid>"
384 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.
387 This command lists all clustered TDB databases that the CTDB daemon has attached to. Some databases are flagged as PERSISTENT, this means that the database stores data persistently and the data will remain across reboots. One example of such a database is secrets.tdb where information about how the cluster was joined to the domain is stored.
389 Most databases are not persistent and only store the state information that the currently running samba daemons need. These databases are always wiped when ctdb/samba starts and when a node is rebooted.
391 Example: ctdb getdbmap
397 Number of databases:10
398 dbid:0x435d3410 name:notify.tdb path:/var/ctdb/notify.tdb.0
399 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0
400 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0
401 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0
402 dbid:0x122224da name:test.tdb path:/var/ctdb/test.tdb.0
403 dbid:0x2672a57f name:idmap2.tdb path:/var/ctdb/persistent/idmap2.tdb.0 PERSISTENT
404 dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT
405 dbid:0xe98e08b6 name:group_mapping.tdb path:/var/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
406 dbid:0x7bbbd26c name:passdb.tdb path:/var/ctdb/persistent/passdb.tdb.0 PERSISTENT
412 This command will dump a clustered TDB database to the screen. This is a debugging command.
415 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.
417 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.
419 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.
420 .SS "setmonmode <0|1>"
422 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.
423 .SS "attach <dbname>"
425 This is a debugging command. This command will make the CTDB daemon create a new CTDB database and attach to it.
428 This is a debugging command. This command will make the ctdb daemon to write a fill memory allocation map to standard output.
431 This command will lock all the local TDB databases causing clients that are accessing these TDBs such as samba3 to block until the databases are thawed.
433 This is primarily used by the recovery daemon to stop all samba daemons from accessing any databases while the database is recovered and rebuilt.
436 Thaw a previously frozen node.
440 \fI\%http://ctdb.samba.org/\fR
441 .SH "COPYRIGHT/LICENSE"
445 Copyright (C) Andrew Tridgell 2007
446 Copyright (C) Ronnie sahlberg 2007
448 This program is free software; you can redistribute it and/or modify
449 it under the terms of the GNU General Public License as published by
450 the Free Software Foundation; either version 3 of the License, or (at
451 your option) any later version.
453 This program is distributed in the hope that it will be useful, but
454 WITHOUT ANY WARRANTY; without even the implied warranty of
455 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
456 General Public License for more details.
458 You should have received a copy of the GNU General Public License
459 along with this program; if not, see http://www.gnu.org/licenses/.