1 <?xml version="1.0" encoding="iso-8859-1"?>
3 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
10 This documentation was written by
19 <holder>Andrew Tridgell</holder>
20 <holder>Ronnie Sahlberg</holder>
24 This program is free software; you can redistribute it and/or
25 modify it under the terms of the GNU General Public License as
26 published by the Free Software Foundation; either version 3 of
27 the License, or (at your option) any later version.
30 This program is distributed in the hope that it will be
31 useful, but WITHOUT ANY WARRANTY; without even the implied
32 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
33 PURPOSE. See the GNU General Public License for more details.
36 You should have received a copy of the GNU General Public
37 License along with this program; if not, see
38 <ulink url="http://www.gnu.org/licenses"/>.
44 <refentrytitle>ctdb</refentrytitle>
45 <manvolnum>1</manvolnum>
46 <refmiscinfo class="source">ctdb</refmiscinfo>
47 <refmiscinfo class="manual">CTDB - clustered TDB database</refmiscinfo>
51 <refname>ctdb</refname>
52 <refpurpose>CTDB management utility</refpurpose>
57 <command>ctdb</command>
58 <arg rep="repeat"><replaceable>OPTION</replaceable></arg>
59 <arg choice="req"><replaceable>COMMAND</replaceable></arg>
60 <arg choice="opt"><replaceable>COMMAND-ARGS</replaceable></arg>
65 <title>DESCRIPTION</title>
67 ctdb is a utility to view and manage a CTDB cluster.
71 The following terms are used when referring to nodes in a
78 Physical Node Number. The physical node number is an
79 integer that describes the node in the cluster. The
80 first node has physical node number 0. in a cluster.
88 This is either a single PNN, a comma-separate list of PNNs
97 Commands that reference a database have a
98 <parameter>DB</parameter> argument. This is either a database
99 name, such as <filename>locking.tdb</filename> or a database ID
100 such as "0x42fe72c5".
105 <title>OPTIONS</title>
108 <varlistentry><term>-n <parameter>PNN-LIST</parameter></term>
111 The nodes specified by PNN-LIST should be queried for the
112 requested information. Default is to query the daemon
113 running on the local host.
118 <varlistentry><term>-Y</term>
121 Produce output in machine readable form for easier parsing
122 by scripts. Not all commands support this option.
127 <varlistentry><term>-t <parameter>TIMEOUT</parameter></term>
130 Indicates that ctdb should wait up to TIMEOUT seconds for
131 a response to most commands sent to the CTDB daemon. The
132 default is 10 seconds.
137 <varlistentry><term>-T <parameter>TIMELIMIT</parameter></term>
140 Indicates that TIMELIMIT is the maximum run time (in
141 seconds) for the ctdb command. When TIMELIMIT is exceeded
142 the ctdb command will terminate with an error. The default
148 <varlistentry><term>-? --help</term>
151 Print some help text to the screen.
156 <varlistentry><term>--usage</term>
159 Print useage information to the screen.
164 <varlistentry><term>-d --debug=<parameter>DEBUGLEVEL</parameter></term>
167 Change the debug level for the command. Default is ERR (0).
172 <varlistentry><term>--socket=<parameter>FILENAME</parameter></term>
175 Specify that FILENAME is the name of the Unix domain
176 socket to use when connecting to the local CTDB
177 daemon. The default is
178 <filename>/tmp/ctdb.socket</filename>.
187 <title>ADMINISTRATIVE COMMANDS</title>
189 These are commands used to monitor and administer a CTDB cluster.
195 This command displays the PNN of the current node.
202 This command displays the PNN of the current node without
203 contacting the CTDB daemon. It parses the nodes file
204 directly, so can produce unexpected output if the nodes file
205 has been edited but has not been reloaded.
210 <title>status</title>
212 This command shows the current status of all CTDB nodes based
213 on information from the queried node.
217 Note: If the the queried node is INACTIVE then the status
218 might not be current.
222 <title>Node status</title>
224 This includes the number of physical nodes and the status of
225 each node. See <citerefentry><refentrytitle>ctdb</refentrytitle>
226 <manvolnum>7</manvolnum></citerefentry> for information
232 <title>Generation</title>
234 The generation id is a number that indicates the current generation
235 of a cluster instance. Each time a cluster goes through a
236 reconfiguration or a recovery its generation id will be changed.
239 This number does not have any particular meaning other than
240 to keep track of when a cluster has gone through a
241 recovery. It is a random number that represents the current
242 instance of a ctdb cluster and its databases. The CTDB
243 daemon uses this number internally to be able to tell when
244 commands to operate on the cluster and the databases was
245 issued in a different generation of the cluster, to ensure
246 that commands that operate on the databases will not survive
247 across a cluster database recovery. After a recovery, all
248 old outstanding commands will automatically become invalid.
251 Sometimes this number will be shown as "INVALID". This only means that
252 the ctdbd daemon has started but it has not yet merged with the cluster through a recovery.
253 All nodes start with generation "INVALID" and are not assigned a real
254 generation id until they have successfully been merged with a cluster
260 <title>Virtual Node Number (VNN) map</title>
262 Consists of the number of virtual nodes and mapping from
263 virtual node numbers to physical node numbers. Virtual
264 nodes host CTDB databases. Only nodes that are
265 participating in the VNN map can become lmaster or dmaster
266 for database records.
271 <title>Recovery mode</title>
273 This is the current recovery mode of the cluster. There are two possible modes:
276 NORMAL - The cluster is fully operational.
279 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.
282 Once the recovery master detects an inconsistency, for example a node
283 becomes disconnected/connected, the recovery daemon will trigger a
284 cluster recovery process, where all databases are remerged across the
285 cluster. When this process starts, the recovery master will first
286 "freeze" all databases to prevent applications such as samba from
287 accessing the databases and it will also mark the recovery mode as
291 When the CTDB daemon starts up, it will start in RECOVERY
292 mode. Once the node has been merged into a cluster and all
293 databases have been recovered, the node mode will change into
294 NORMAL mode and the databases will be "thawed", allowing samba
295 to access the databases again.
299 <title>Recovery master</title>
301 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.
304 Only one node at a time can be the designated recovery master. Which
305 node is designated the recovery master is decided by an election
306 process in the recovery daemons running on each node.
311 <title>Example</title>
315 pnn:0 192.168.2.200 OK (THIS NODE)
316 pnn:1 192.168.2.201 OK
317 pnn:2 192.168.2.202 OK
318 pnn:3 192.168.2.203 OK
319 Generation:1362079228
325 Recovery mode:NORMAL (0)
332 <title>nodestatus <optional><parameter>PNN-LIST</parameter></optional></title>
334 This command is similar to the <command>status</command>
335 command. It displays the "node status" subset of output. The
336 main differences are:
342 The exit code is the bitwise-OR of the flags for each
343 specified node, while <command>ctdb status</command> exits
344 with 0 if it was able to retrieve status for all nodes.
350 <command>ctdb status</command> provides status information
351 for all nodes. <command>ctdb nodestatus</command>
352 defaults to providing status for only the current node.
353 If PNN-LIST is provided then status is given for
354 the indicated node(s).
358 By default, <command>ctdb nodestatus</command> gathers
359 status from the local node. However, if invoked with "-n
360 all" (or similar) then status is gathered from the given
361 node(s). In particular <command>ctdb nodestatus
362 all</command> and <command>ctdb nodestatus -n
363 all</command> will produce different output. It is
364 possible to provide 2 different nodespecs (with and
365 without "-n") but the output is usually confusing!
371 A common invocation in scripts is <command>ctdb nodestatus
372 all</command> to check whether all nodes in a cluster are
377 <title>Example</title>
380 pnn:0 10.0.0.30 OK (THIS NODE)
382 # ctdb nodestatus all
384 pnn:0 10.0.0.30 OK (THIS NODE)
391 <title>recmaster</title>
393 This command shows the pnn of the node which is currently the recmaster.
397 Note: If the the queried node is INACTIVE then the status
398 might not be current.
403 <title>uptime</title>
405 This command shows the uptime for the ctdb daemon. When the last recovery or ip-failover completed and how long it took. If the "duration" is shown as a negative number, this indicates that there is a recovery/failover in progress and it started that many seconds ago.
409 <title>Example</title>
412 Current time of node : Thu Oct 29 10:38:54 2009
413 Ctdbd start time : (000 16:54:28) Wed Oct 28 17:44:26 2009
414 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
415 Duration of last recovery/failover: 2.248552 seconds
421 <title>listnodes</title>
423 This command shows lists the ip addresses of all the nodes in the cluster.
427 <title>Example</title>
439 <title>natgwlist</title>
441 Show the current NAT gateway master and the status of all
442 nodes in the current NAT gateway group. See the
443 <citetitle>NAT GATEWAY</citetitle> section in
444 <citerefentry><refentrytitle>ctdb</refentrytitle>
445 <manvolnum>7</manvolnum></citerefentry> for more details.
449 <title>Example</title>
454 pnn:0 192.168.2.200 OK (THIS NODE)
455 pnn:1 192.168.2.201 OK
456 pnn:2 192.168.2.202 OK
457 pnn:3 192.168.2.203 OK
465 This command will "ping" specified CTDB nodes in the cluster
466 to verify that they are running.
469 <title>Example</title>
472 response from 0 time=0.000054 sec (3 clients)
473 response from 1 time=0.000144 sec (2 clients)
474 response from 2 time=0.000105 sec (2 clients)
475 response from 3 time=0.000114 sec (2 clients)
481 <title>ifaces</title>
483 This command will display the list of network interfaces, which could
484 host public addresses, along with their status.
487 <title>Example</title>
491 name:eth5 link:up references:2
492 name:eth4 link:down references:0
493 name:eth3 link:up references:1
494 name:eth2 link:up references:1
497 :Name:LinkStatus:References:
509 This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip. By default this command will ONLY show those public addresses that are known to the node itself. To see the full list of all public ips across the cluster you must use "ctdb ip -n all".
512 <title>Example</title>
516 172.31.91.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
517 172.31.91.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
518 172.31.91.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
519 172.31.91.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
520 172.31.92.82 node[1] active[] available[eth5] configured[eth4,eth5]
521 172.31.92.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
522 172.31.92.84 node[1] active[] available[eth5] configured[eth4,eth5]
523 172.31.92.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
526 :Public IP:Node:ActiveInterface:AvailableInterfaces:ConfiguredInterfaces:
527 :172.31.91.82:1::eth2,eth3:eth2,eth3:
528 :172.31.91.83:0:eth3:eth2,eth3:eth2,eth3:
529 :172.31.91.84:1::eth2,eth3:eth2,eth3:
530 :172.31.91.85:0:eth2:eth2,eth3:eth2,eth3:
531 :172.31.92.82:1::eth5:eth4,eth5:
532 :172.31.92.83:0:eth5:eth5:eth4,eth5:
533 :172.31.92.84:1::eth5:eth4,eth5:
534 :172.31.92.85:0:eth5:eth5:eth4,eth5:
540 <title>ipinfo <parameter>IP</parameter></title>
542 This command will display details about the specified public addresses.
545 <title>Example</title>
547 # ctdb ipinfo 172.31.92.85
548 Public IP[172.31.92.85] info on node 0
552 Interface[1]: Name:eth4 Link:down References:0
553 Interface[2]: Name:eth5 Link:up References:2 (active)
559 <title>scriptstatus</title>
561 This command displays which scripts where run in the previous monitoring cycle and the result of each script. If a script failed with an error, causing the node to become unhealthy, the output from that script is also shown.
564 <title>Example</title>
567 7 scripts were executed last monitoring cycle
568 00.ctdb Status:OK Duration:0.056 Tue Mar 24 18:56:57 2009
569 10.interface Status:OK Duration:0.077 Tue Mar 24 18:56:57 2009
570 11.natgw Status:OK Duration:0.039 Tue Mar 24 18:56:57 2009
571 20.multipathd Status:OK Duration:0.038 Tue Mar 24 18:56:57 2009
572 31.clamd Status:DISABLED
573 40.vsftpd Status:OK Duration:0.045 Tue Mar 24 18:56:57 2009
574 41.httpd Status:OK Duration:0.039 Tue Mar 24 18:56:57 2009
575 50.samba Status:ERROR Duration:0.082 Tue Mar 24 18:56:57 2009
576 OUTPUT:ERROR: Samba tcp port 445 is not responding
582 <title>disablescript <parameter>SCRIPT</parameter></title>
584 This command is used to disable an eventscript.
587 This will take effect the next time the eventscripts are being executed so it can take a short while until this is reflected in 'scriptstatus'.
592 <title>enablescript <parameter>SCRIPT</parameter></title>
594 This command is used to enable an eventscript.
597 This will take effect the next time the eventscripts are being executed so it can take a short while until this is reflected in 'scriptstatus'.
602 <title>listvars</title>
604 List all tuneable variables, except the values of the obsolete tunables
605 like VacuumMinInterval. The obsolete tunables can be retrieved only
606 explicitly with the "ctdb getvar" command.
609 <title>Example</title>
613 SeqnumInterval = 1000
616 KeepaliveInterval = 5
623 TickleUpdateInterval = 20
624 EventScriptTimeout = 30
625 EventScriptTimeoutCount = 1
626 RecoveryGracePeriod = 120
627 RecoveryBanPeriod = 300
628 DatabaseHashSize = 100001
630 RerecoveryTimeout = 10
634 ReclockPingPeriod = 60
636 DisableIPFailover = 0
637 VerboseMemoryNames = 0
641 RecLockLatencyMs = 1000
642 RecoveryDropAllIPs = 120
643 VerifyRecoveryLock = 1
645 VacuumMaxRunTime = 30
648 VacuumFastPathCount = 60
649 MaxQueueDropMsg = 1000000
651 AllowUnhealthyDBRead = 0
652 StatHistoryInterval = 1
653 DeferredAttachTO = 120
654 AllowClientDBAttach = 1
655 RecoverPDBBySeqNum = 0
661 <title>getvar <parameter>NAME</parameter></title>
663 Get the runtime value of a tuneable variable.
666 <title>Example</title>
668 # ctdb getvar MaxRedirectCount
675 <title>setvar <parameter>NAME</parameter> <parameter>VALUE</parameter></title>
677 Set the runtime value of a tuneable variable.
680 Example: ctdb setvar MaxRedirectCount 5
685 <title>lvsmaster</title>
687 This command shows which node is currently the LVSMASTER. The
688 LVSMASTER is the node in the cluster which drives the LVS system and
689 which receives all incoming traffic from clients.
692 LVS is the mode where the entire CTDB/Samba cluster uses a single
693 ip address for the entire cluster. In this mode all clients connect to
694 one specific node which will then multiplex/loadbalance the clients
695 evenly onto the other nodes in the cluster. This is an alternative to using
696 public ip addresses. See the manpage for ctdbd for more information
704 This command shows which nodes in the cluster are currently active in the
705 LVS configuration. I.e. which nodes we are currently loadbalancing
706 the single ip address across.
710 LVS will by default only loadbalance across those nodes that are both
711 LVS capable and also HEALTHY. Except if all nodes are UNHEALTHY in which
712 case LVS will loadbalance across all UNHEALTHY nodes as well.
713 LVS will never use nodes that are DISCONNECTED, STOPPED, BANNED or
729 <title>getcapabilities</title>
732 This command shows the capabilities of the current node. See
733 the <citetitle>CAPABILITIES</citetitle> section in
734 <citerefentry><refentrytitle>ctdb</refentrytitle>
735 <manvolnum>7</manvolnum></citerefentry> for more details.
751 <title>statistics</title>
753 Collect statistics from the CTDB daemon about how many calls it has served.
756 <title>Example</title>
763 client_packets_sent 360489
764 client_packets_recv 360466
765 node_packets_sent 480931
766 node_packets_recv 240120
767 keepalive_packets_sent 4
768 keepalive_packets_recv 3
789 pending_lockwait_calls 0
792 max_call_latency 4.948321 sec
793 max_lockwait_latency 0.000000 sec
799 <title>statisticsreset</title>
801 This command is used to clear all statistics counters in a node.
804 Example: ctdb statisticsreset
809 <title>dbstatistics <parameter>DB</parameter></title>
811 Display statistics about the database DB.
814 <title>Example</title>
816 # ctdb dbstatistics locking.tdb
817 DB Statistics: locking.tdb
825 hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
826 lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
827 locks_latency MIN/AVG/MAX 0.001066/0.012686/4.202292 sec out of 14356
829 Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
835 <title>getreclock</title>
837 This command is used to show the filename of the reclock file that is used.
844 Reclock file:/gpfs/.ctdb/shared
850 <title>setreclock [filename]</title>
852 This command is used to modify, or clear, the file that is used as the reclock file at runtime. When this command is used, the reclock file checks are disabled. To re-enable the checks the administrator needs to activate the "VerifyRecoveryLock" tunable using "ctdb setvar".
856 If run with no parameter this will remove the reclock file completely. If run with a parameter the parameter specifies the new filename to use for the recovery lock.
860 This command only affects the runtime settings of a ctdb node and will be lost when ctdb is restarted. For persistent changes to the reclock file setting you must edit /etc/sysconfig/ctdb.
867 <title>getdebug</title>
869 Get the current debug level for the node. the debug level controls what information is written to the log file.
872 The debug levels are mapped to the corresponding syslog levels.
873 When a debug level is set, only those messages at that level and higher
874 levels will be printed.
877 The list of debug levels from highest to lowest are :
880 EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
885 <title>setdebug <parameter>DEBUGLEVEL</parameter></title>
887 Set the debug level of a node. This controls what information will be logged.
890 The debuglevel is one of EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
895 <title>getpid</title>
897 This command will return the process id of the ctdb daemon.
902 <title>disable</title>
904 This command is used to administratively disable a node in the cluster.
905 A disabled node will still participate in the cluster and host
906 clustered TDB records but its public ip address has been taken over by
907 a different node and it no longer hosts any services.
912 <title>enable</title>
914 Re-enable a node that has been administratively disabled.
921 This command is used to administratively STOP a node in the cluster.
922 A STOPPED node is connected to the cluster but will not host any
923 public ip addresse, nor does it participate in the VNNMAP.
924 The difference between a DISABLED node and a STOPPED node is that
925 a STOPPED node does not host any parts of the database which means
926 that a recovery is required to stop/continue nodes.
931 <title>continue</title>
933 Re-start a node that has been administratively stopped.
938 <title>addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter></title>
940 This command is used to add a new public ip to a node during runtime.
941 This allows public addresses to be added to a cluster without having
942 to restart the ctdb daemons.
945 Note that this only updates the runtime instance of ctdb. Any changes will be lost next time ctdb is restarted and the public addresses file is re-read.
946 If you want this change to be permanent you must also update the public addresses file manually.
951 <title>delip <parameter>IPADDR</parameter></title>
953 This command is used to remove a public ip from a node during runtime.
954 If this public ip is currently hosted by the node it being removed from, the ip will first be failed over to another node, if possible, before it is removed.
957 Note that this only updates the runtime instance of ctdb. Any changes will be lost next time ctdb is restarted and the public addresses file is re-read.
958 If you want this change to be permanent you must also update the public addresses file manually.
963 <title>moveip <parameter>IPADDR</parameter> <parameter>PNN</parameter></title>
965 This command can be used to manually fail a public ip address to a
969 In order to manually override the "automatic" distribution of public
970 ip addresses that ctdb normally provides, this command only works
971 when you have changed the tunables for the daemon to:
982 <title>shutdown</title>
984 This command will shutdown a specific CTDB daemon.
989 <title>setlmasterrole on|off</title>
991 This command is used ot enable/disable the LMASTER capability for a node at runtime. This capability determines whether or not a node can be used as an LMASTER for records in the database. A node that does not have the LMASTER capability will not show up in the vnnmap.
995 Nodes will by default have this capability, but it can be stripped off nodes by the setting in the sysconfig file or by using this command.
998 Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
1001 See also "ctdb getcapabilities"
1006 <title>setrecmasterrole on|off</title>
1008 This command is used ot enable/disable the RECMASTER capability for a node at runtime. This capability determines whether or not a node can be used as an RECMASTER for the cluster. A node that does not have the RECMASTER capability can not win a recmaster election. A node that already is the recmaster for the cluster when the capability is stripped off the node will remain the recmaster until the next cluster election.
1012 Nodes will by default have this capability, but it can be stripped off nodes by the setting in the sysconfig file or by using this command.
1015 See also "ctdb getcapabilities"
1020 <title>reloadnodes</title>
1022 This command is used when adding new nodes, or removing existing nodes from an existing cluster.
1025 Procedure to add a node:
1028 1, To expand an existing cluster, first ensure with 'ctdb status' that
1029 all nodes are up and running and that they are all healthy.
1030 Do not try to expand a cluster unless it is completely healthy!
1033 2, On all nodes, edit /etc/ctdb/nodes and add the new node as the last
1034 entry to the file. The new node MUST be added to the end of this file!
1037 3, Verify that all the nodes have identical /etc/ctdb/nodes files after you edited them and added the new node!
1040 4, Run 'ctdb reloadnodes' to force all nodes to reload the nodesfile.
1043 5, Use 'ctdb status' on all nodes and verify that they now show the additional node.
1046 6, Install and configure the new node and bring it online.
1049 Procedure to remove a node:
1052 1, To remove a node from an existing cluster, first ensure with 'ctdb status' that
1053 all nodes, except the node to be deleted, are up and running and that they are all healthy.
1054 Do not try to remove a node from a cluster unless the cluster is completely healthy!
1057 2, Shutdown and poweroff the node to be removed.
1060 3, On all other nodes, edit the /etc/ctdb/nodes file and comment out the node to be removed. Do not delete the line for that node, just comment it out by adding a '#' at the beginning of the line.
1063 4, Run 'ctdb reloadnodes' to force all nodes to reload the nodesfile.
1066 5, Use 'ctdb status' on all nodes and verify that the deleted node no longer shows up in the list..
1076 <optional><parameter>PNN-LIST</parameter></optional>
1079 This command reloads the public addresses configuration file
1080 on the specified nodes. When it completes addresses will be
1081 reconfigured and reassigned across the cluster as necessary.
1086 <title>getdbmap</title>
1088 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.
1091 If a PERSISTENT database is not in a healthy state the database is
1092 flagged as UNHEALTHY. If there's at least one completely healthy node running in
1093 the cluster, it's possible that the content is restored by a recovery
1094 run automaticly. Otherwise an administrator needs to analyze the
1098 See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1099 "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1100 and (if samba or tdb-utils are installed) "tdbtool check".
1103 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.
1107 <title>Example</title>
1110 Number of databases:10
1111 dbid:0x435d3410 name:notify.tdb path:/var/ctdb/notify.tdb.0
1112 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0
1113 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0
1114 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0
1115 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0
1116 dbid:0x122224da name:test.tdb path:/var/ctdb/test.tdb.0
1117 dbid:0x2672a57f name:idmap2.tdb path:/var/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1118 dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT
1119 dbid:0xe98e08b6 name:group_mapping.tdb path:/var/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1120 dbid:0x7bbbd26c name:passdb.tdb path:/var/ctdb/persistent/passdb.tdb.0 PERSISTENT
1122 # ctdb getdbmap # example for unhealthy database
1123 Number of databases:1
1124 dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1127 :ID:Name:Path:Persistent:Unhealthy:
1128 :0x7bbbd26c:passdb.tdb:/var/ctdb/persistent/passdb.tdb.0:1:0:
1136 <parameter>DB</parameter>
1137 <parameter>FILE</parameter>
1140 Copy the contents of database DB to FILE. FILE can later be
1141 read back using <command>restoredb</command>. This is mainly
1142 useful for backing up persistent databases such as
1143 <filename>secrets.tdb</filename> and similar.
1150 <parameter>FILE</parameter>
1151 <optional><parameter>DB</parameter></optional>
1154 This command restores a persistent database that was
1155 previously backed up using backupdb. By default the data will
1156 be restored back into the same database as it was created
1157 from. By specifying dbname you can restore the data into a
1163 <title>getlog [<parameter>LEVEL</parameter>] [recoverd]</title>
1165 In addition to the normal logging to a log file, CTDB also
1166 keeps a in-memory ringbuffer containing the most recent log
1167 entries for all log levels (except DEBUG).
1170 This is useful since it allows for keeping continuous logs to a file
1171 at a reasonable non-verbose level, but shortly after an incident has
1172 occured, a much more detailed log can be pulled from memory. This
1173 can allow you to avoid having to reproduce an issue due to the
1174 on-disk logs being of insufficient detail.
1177 This command extracts all messages of level or lower log level
1178 from memory and prints it to the screen. The level is not
1179 specified it defaults to NOTICE.
1182 By default, logs are extracted from the main CTDB daemon. If
1183 the recoverd option is given then logs are extracted from the
1189 <title>clearlog [recoverd]</title>
1191 This command clears the in-memory logging ringbuffer.
1194 By default, logs are cleared in the main CTDB daemon. If the
1195 recoverd option is given then logs are cleared in the recovery
1201 <title>setdbreadonly <parameter>DB</parameter></title>
1203 This command will enable the read-only record support for a
1204 database. This is an experimental feature to improve
1205 performance for contended records primarily in locking.tdb and
1206 brlock.tdb. When enabling this feature you must set it on all
1207 nodes in the cluster.
1212 <title>setdbsticky <parameter>DB</parameter></title>
1214 This command will enable the sticky record support for the
1215 specified database. This is an experimental feature to
1216 improve performance for contended records primarily in
1217 locking.tdb and brlock.tdb. When enabling this feature you
1218 must set it on all nodes in the cluster.
1225 <title>INTERNAL COMMANDS</title>
1228 Internal commands are used by CTDB's scripts and are not
1229 required for managing a CTDB cluster. Their parameters and
1230 behaviour are subject to change.
1234 <title>gettickles <parameter>IPADDR</parameter></title>
1236 Show TCP connections that are registered with CTDB to be
1237 "tickled" if there is a failover.
1242 <title>gratiousarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1244 Send out a gratious ARP for the specified interface through
1245 the specified interface. This command is mainly used by the
1251 <title>killtcp</title>
1253 Read a list of TCP connections, one per line, from standard
1254 input and terminate each connection. A connection is
1258 <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1261 Each connection is terminated by issuing a TCP RST to the
1262 SRC-IPADDR:SRC-PORT endpoint.
1265 A single connection can be specified on the command-line
1266 rather than on standard input.
1272 pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1281 pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1284 Print the value associated with KEY in DB.
1291 <parameter>DB</parameter>
1292 <parameter>KEY</parameter>
1293 <parameter>FILE</parameter>
1296 Store KEY in DB with contents of FILE as the associated value.
1303 <parameter>DB</parameter>
1304 <optional><parameter>FILE</parameter></optional>
1307 Read a list of key-value pairs, one per line from FILE, and
1308 store them in DB using a single transaction. An empty value
1309 is equivalent to deleting the given key.
1312 The key and value should be separated by spaces or tabs. Each
1313 key/value should be a printable string enclosed in
1319 <title>runstate [setup|first_recovery|startup|running]</title>
1321 Print the runstate of the specified node. Runstates are used
1322 to serialise important state transitions in CTDB, particularly
1326 If one or more optional runstate arguments are specified then
1327 the node must be in one of these runstates for the command to
1331 <title>Example</title>
1340 <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1342 Set the internal state of network interface IFACE. This is
1343 typically used in the <filename>10.interface</filename> script
1344 in the "monitor" event.
1347 Example: ctdb setifacelink eth0 up
1352 <title>setnatgwstate on|off</title>
1354 Enable or disable the NAT gateway master capability on a node.
1359 <title>tickle <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter></title>
1361 Send a TCP tickle to the source host for the specified TCP
1362 connection. A TCP tickle is a TCP ACK packet with an invalid
1363 sequence and acknowledge number and will when received by the
1364 source host result in it sending an immediate correct ACK back
1368 TCP tickles are useful to "tickle" clients after a IP failover has
1369 occured since this will make the client immediately recognize the
1370 TCP connection has been disrupted and that the client will need
1371 to reestablish. This greatly speeds up the time it takes for a client
1372 to detect and reestablish after an IP failover in the ctdb cluster.
1377 <title>version</title>
1379 Display the CTDB version.
1386 <title>DEBUGGING COMMANDS</title>
1388 These commands are primarily used for CTDB development and testing and
1389 should not be used for normal administration.
1394 <title>OPTIONS</title>
1397 <varlistentry><term>--print-emptyrecords</term>
1400 This enables printing of empty records when dumping databases
1401 with the catdb, cattbd and dumpdbbackup commands. Records with
1402 empty data segment are considered deleted by ctdb and cleaned
1403 by the vacuuming mechanism, so this switch can come in handy for
1404 debugging the vacuuming behaviour.
1409 <varlistentry><term>--print-datasize</term>
1412 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1413 size of the record data instead of dumping the data contents.
1418 <varlistentry><term>--print-lmaster</term>
1421 This lets catdb print the lmaster for each record.
1426 <varlistentry><term>--print-hash</term>
1429 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1430 hash for each record.
1435 <varlistentry><term>--print-recordflags</term>
1438 This lets catdb and dumpdbbackup print the
1439 record flags for each record. Note that cattdb always
1449 <title>process-exists <parameter>PID</parameter></title>
1451 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.
1456 <title>getdbstatus <parameter>DB</parameter></title>
1458 This command displays more details about a database.
1461 <title>Example</title>
1463 # ctdb getdbstatus test.tdb.0
1466 path: /var/ctdb/test.tdb.0
1470 # ctdb getdbstatus registry.tdb # with a corrupted TDB
1473 path: /var/ctdb/persistent/registry.tdb.0
1475 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/var/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1481 <title>catdb <parameter>DB</parameter></title>
1483 Print a dump of the clustered TDB database DB.
1488 <title>cattdb <parameter>DB</parameter></title>
1490 Print a dump of the contents of the local TDB database DB.
1495 <title>dumpdbbackup <parameter>FILE</parameter></title>
1497 Print a dump of the contents from database backup FILE,
1498 similar to <command>catdb</command>.
1503 <title>wipedb <parameter>DB</parameter></title>
1505 Remove all contents of database DB.
1510 <title>recover</title>
1512 This command will trigger the recovery daemon to do a cluster
1518 <title>ipreallocate, sync</title>
1520 This command will force the recovery master to perform a full ip reallocation process and redistribute all ip addresses. This is useful to "reset" the allocations back to its default state if they have been changed using the "moveip" command. While a "recover" will also perform this reallocation, a recovery is much more hevyweight since it will also rebuild all the databases.
1525 <title>getmonmode</title>
1527 This command returns the monutoring mode of a node. The monitoring mode is either ACTIVE or DISABLED. Normally a node will continuously monitor that all other nodes that are expected are in fact connected and that they respond to commands.
1530 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.
1533 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.
1539 <title>setmonmode 0|1</title>
1541 This command can be used to explicitly 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.
1546 <title>attach <parameter>DBNAME</parameter> [persistent]</title>
1548 This is a debugging command. This command will make the CTDB daemon create a new CTDB database and attach to it.
1553 <title>dumpmemory</title>
1555 This is a debugging command. This command will make the ctdb
1556 daemon to write a fill memory allocation map to standard output.
1561 <title>rddumpmemory</title>
1563 This is a debugging command. This command will dump the talloc memory
1564 allocation tree for the recovery daemon to standard output.
1571 Thaw a previously frozen node.
1577 <title>eventscript <parameter>ARGUMENTS</parameter></title>
1579 This is a debugging command. This command can be used to manually
1580 invoke and run the eventscritps with arbitrary arguments.
1585 <title>ban <parameter>BANTIME</parameter></title>
1587 Administratively ban a node for BANTIME seconds. The node
1588 will be unbanned after BANTIME seconds have elapsed.
1591 A banned node does not participate in the cluster. It does
1592 not host any records for the clustered TDB and does not host
1593 any public IP addresses.
1596 Nodes are automatically banned if they misbehave. For
1597 example, a node may be banned if it causes too many cluster
1601 To administratively exclude a node from a cluster use the
1602 <command>stop</command> command.
1607 <title>unban</title>
1609 This command is used to unban a node that has either been
1610 administratively banned using the ban command or has been
1611 automatically banned.
1618 <optional><parameter>PNN-LIST</parameter></optional>
1621 This command marks the given nodes as rebalance targets in the
1622 LCP2 IP allocation algorithm. The
1623 <command>reloadips</command> command will do this as necessary
1624 so this command should not be needed.
1629 <title>check_srvids <parameter>SRVID</parameter> ...</title>
1631 This command checks whether a set of srvid message ports are
1632 registered on the node or not. The command takes a list of
1636 <title>Example</title>
1638 # ctdb check_srvids 1 2 3 14765
1639 Server id 0:1 does not exist
1640 Server id 0:2 does not exist
1641 Server id 0:3 does not exist
1642 Server id 0:14765 exists
1648 <title>vacuum [<parameter>max-records</parameter>]</title>
1650 Over time CTDB databases will fill up with empty deleted
1651 records which will lead to a progressive slow down of CTDB
1652 database access. This command is used to prune all databases
1653 and delete all empty records from the cluster.
1657 By default, vacuum will delete all empty records from all databases.
1658 If [max_records] is specified, the command will only delete the first
1659 [max_records] empty records for each database.
1663 Vacuum only deletes records where the local node is the
1664 lmaster. To delete all records from the entire cluster you
1665 need to run a vacuum from each node.
1667 This command is not disruptive. Samba is unaffected and will still be able to read/write records normally while the database is being vacuumed.
1671 Example: ctdb vacuum
1675 By default, this operation is issued from the 00.ctdb event script every 5 minutes.
1680 <title>repack [max_freelist]</title>
1682 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.
1683 This command is used to defragment a TDB database and pruning the freelist.
1687 If [max_freelist] is specified, then a database will only be repacked if it has more than this number of entries in the freelist.
1690 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.
1694 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.
1698 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.
1702 Example: ctdb repack 1000
1706 By default, this operation is issued from the 00.ctdb event script every 5 minutes.
1713 <!-- UNDOCUMENTED: showban stats disablemonitor enablemonitor
1714 isnotrecmaster addtickle deltickle regsrvid unregsrvid chksrvid
1715 getsrvids rebalanceip setdbprio getdbprio msglisten msgsend
1716 tfetch tstore readkey writekey
1717 checktcpport getdbseqnum ipiface
1721 <title>SEE ALSO</title>
1723 <citerefentry><refentrytitle>ctdbd</refentrytitle>
1724 <manvolnum>1</manvolnum></citerefentry>,
1726 <citerefentry><refentrytitle>onnode</refentrytitle>
1727 <manvolnum>1</manvolnum></citerefentry>,
1729 <citerefentry><refentrytitle>ctdb</refentrytitle>
1730 <manvolnum>7</manvolnum></citerefentry>,
1732 <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1733 <manvolnum>7</manvolnum></citerefentry>,
1735 <ulink url="http://ctdb.samba.org/"/>