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 use the following terms:
103 This is either a database name, such as
104 <filename>locking.tdb</filename> or a database ID such
113 A space separated list of at least one
114 <parameter>DB</parameter>.
123 <title>OPTIONS</title>
126 <varlistentry><term>-n <parameter>PNN-LIST</parameter></term>
129 The nodes specified by PNN-LIST should be queried for the
130 requested information. Default is to query the daemon
131 running on the local host.
136 <varlistentry><term>-Y</term>
139 Produce output in machine readable form for easier parsing
140 by scripts. This uses a field delimiter of ':'. Not all
141 commands support this option.
146 <varlistentry><term>-x <parameter>SEPARATOR</parameter></term>
149 Use SEPARATOR to delimit fields in machine readable output.
155 <varlistentry><term>-X</term>
158 Produce output in machine readable form for easier parsing
159 by scripts. This uses a field delimiter of '|'. Not all
160 commands support this option.
163 This is equivalent to "-x|" and avoids some shell quoting
169 <varlistentry><term>-t <parameter>TIMEOUT</parameter></term>
172 Indicates that ctdb should wait up to TIMEOUT seconds for
173 a response to most commands sent to the CTDB daemon. The
174 default is 10 seconds.
179 <varlistentry><term>-T <parameter>TIMELIMIT</parameter></term>
182 Indicates that TIMELIMIT is the maximum run time (in
183 seconds) for the ctdb command. When TIMELIMIT is exceeded
184 the ctdb command will terminate with an error. The default
190 <varlistentry><term>-? --help</term>
193 Print some help text to the screen.
198 <varlistentry><term>--usage</term>
201 Print useage information to the screen.
206 <varlistentry><term>-d --debug=<parameter>DEBUGLEVEL</parameter></term>
209 Change the debug level for the command. Default is NOTICE (2).
214 <varlistentry><term>--socket=<parameter>FILENAME</parameter></term>
217 Specify that FILENAME is the name of the Unix domain
218 socket to use when connecting to the local CTDB
219 daemon. The default is
220 <filename>/usr/local/var/run/ctdb/ctdbd.socket</filename>.
229 <title>ADMINISTRATIVE COMMANDS</title>
231 These are commands used to monitor and administer a CTDB cluster.
237 This command displays the PNN of the current node.
244 This command displays the PNN of the current node without
245 contacting the CTDB daemon. It parses the nodes file
246 directly, so can produce unexpected output if the nodes file
247 has been edited but has not been reloaded.
252 <title>status</title>
254 This command shows the current status of all CTDB nodes based
255 on information from the queried node.
259 Note: If the the queried node is INACTIVE then the status
260 might not be current.
264 <title>Node status</title>
266 This includes the number of physical nodes and the status of
267 each node. See <citerefentry><refentrytitle>ctdb</refentrytitle>
268 <manvolnum>7</manvolnum></citerefentry> for information
274 <title>Generation</title>
276 The generation id is a number that indicates the current generation
277 of a cluster instance. Each time a cluster goes through a
278 reconfiguration or a recovery its generation id will be changed.
281 This number does not have any particular meaning other than
282 to keep track of when a cluster has gone through a
283 recovery. It is a random number that represents the current
284 instance of a ctdb cluster and its databases. The CTDB
285 daemon uses this number internally to be able to tell when
286 commands to operate on the cluster and the databases was
287 issued in a different generation of the cluster, to ensure
288 that commands that operate on the databases will not survive
289 across a cluster database recovery. After a recovery, all
290 old outstanding commands will automatically become invalid.
293 Sometimes this number will be shown as "INVALID". This only means that
294 the ctdbd daemon has started but it has not yet merged with the cluster through a recovery.
295 All nodes start with generation "INVALID" and are not assigned a real
296 generation id until they have successfully been merged with a cluster
302 <title>Virtual Node Number (VNN) map</title>
304 Consists of the number of virtual nodes and mapping from
305 virtual node numbers to physical node numbers. Virtual
306 nodes host CTDB databases. Only nodes that are
307 participating in the VNN map can become lmaster or dmaster
308 for database records.
313 <title>Recovery mode</title>
315 This is the current recovery mode of the cluster. There are two possible modes:
318 NORMAL - The cluster is fully operational.
321 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.
324 Once the recovery master detects an inconsistency, for example a node
325 becomes disconnected/connected, the recovery daemon will trigger a
326 cluster recovery process, where all databases are remerged across the
327 cluster. When this process starts, the recovery master will first
328 "freeze" all databases to prevent applications such as samba from
329 accessing the databases and it will also mark the recovery mode as
333 When the CTDB daemon starts up, it will start in RECOVERY
334 mode. Once the node has been merged into a cluster and all
335 databases have been recovered, the node mode will change into
336 NORMAL mode and the databases will be "thawed", allowing samba
337 to access the databases again.
341 <title>Recovery master</title>
343 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.
346 Only one node at a time can be the designated recovery master. Which
347 node is designated the recovery master is decided by an election
348 process in the recovery daemons running on each node.
353 <title>Example</title>
357 pnn:0 192.168.2.200 OK (THIS NODE)
358 pnn:1 192.168.2.201 OK
359 pnn:2 192.168.2.202 OK
360 pnn:3 192.168.2.203 OK
361 Generation:1362079228
367 Recovery mode:NORMAL (0)
374 <title>nodestatus <optional><parameter>PNN-LIST</parameter></optional></title>
376 This command is similar to the <command>status</command>
377 command. It displays the "node status" subset of output. The
378 main differences are:
384 The exit code is the bitwise-OR of the flags for each
385 specified node, while <command>ctdb status</command> exits
386 with 0 if it was able to retrieve status for all nodes.
392 <command>ctdb status</command> provides status information
393 for all nodes. <command>ctdb nodestatus</command>
394 defaults to providing status for only the current node.
395 If PNN-LIST is provided then status is given for
396 the indicated node(s).
402 A common invocation in scripts is <command>ctdb nodestatus
403 all</command> to check whether all nodes in a cluster are
408 <title>Example</title>
411 pnn:0 10.0.0.30 OK (THIS NODE)
413 # ctdb nodestatus all
415 pnn:0 10.0.0.30 OK (THIS NODE)
422 <title>recmaster</title>
424 This command shows the pnn of the node which is currently the recmaster.
428 Note: If the the queried node is INACTIVE then the status
429 might not be current.
434 <title>uptime</title>
436 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.
440 <title>Example</title>
443 Current time of node : Thu Oct 29 10:38:54 2009
444 Ctdbd start time : (000 16:54:28) Wed Oct 28 17:44:26 2009
445 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
446 Duration of last recovery/failover: 2.248552 seconds
452 <title>listnodes</title>
454 This command shows lists the ip addresses of all the nodes in the cluster.
458 <title>Example</title>
470 <title>natgwlist</title>
472 Show the current NAT gateway master and the status of all
473 nodes in the current NAT gateway group. See the
474 <citetitle>NAT GATEWAY</citetitle> section in
475 <citerefentry><refentrytitle>ctdb</refentrytitle>
476 <manvolnum>7</manvolnum></citerefentry> for more details.
480 <title>Example</title>
485 pnn:0 192.168.2.200 OK (THIS NODE)
486 pnn:1 192.168.2.201 OK
487 pnn:2 192.168.2.202 OK
488 pnn:3 192.168.2.203 OK
496 This command will "ping" specified CTDB nodes in the cluster
497 to verify that they are running.
500 <title>Example</title>
503 response from 0 time=0.000054 sec (3 clients)
509 <title>ifaces</title>
511 This command will display the list of network interfaces, which could
512 host public addresses, along with their status.
515 <title>Example</title>
519 name:eth5 link:up references:2
520 name:eth4 link:down references:0
521 name:eth3 link:up references:1
522 name:eth2 link:up references:1
525 |Name|LinkStatus|References|
537 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 all".
540 <title>Example</title>
544 172.31.91.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
545 172.31.91.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
546 172.31.91.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
547 172.31.91.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
548 172.31.92.82 node[1] active[] available[eth5] configured[eth4,eth5]
549 172.31.92.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
550 172.31.92.84 node[1] active[] available[eth5] configured[eth4,eth5]
551 172.31.92.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
554 |Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|
555 |172.31.91.82|1||eth2,eth3|eth2,eth3|
556 |172.31.91.83|0|eth3|eth2,eth3|eth2,eth3|
557 |172.31.91.84|1||eth2,eth3|eth2,eth3|
558 |172.31.91.85|0|eth2|eth2,eth3|eth2,eth3|
559 |172.31.92.82|1||eth5|eth4,eth5|
560 |172.31.92.83|0|eth5|eth5|eth4,eth5|
561 |172.31.92.84|1||eth5|eth4,eth5|
562 |172.31.92.85|0|eth5|eth5|eth4,eth5|
568 <title>ipinfo <parameter>IP</parameter></title>
570 This command will display details about the specified public addresses.
573 <title>Example</title>
575 # ctdb ipinfo 172.31.92.85
576 Public IP[172.31.92.85] info on node 0
580 Interface[1]: Name:eth4 Link:down References:0
581 Interface[2]: Name:eth5 Link:up References:2 (active)
587 <title>scriptstatus</title>
589 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.
592 <title>Example</title>
595 7 scripts were executed last monitoring cycle
596 00.ctdb Status:OK Duration:0.056 Tue Mar 24 18:56:57 2009
597 10.interface Status:OK Duration:0.077 Tue Mar 24 18:56:57 2009
598 11.natgw Status:OK Duration:0.039 Tue Mar 24 18:56:57 2009
599 20.multipathd Status:OK Duration:0.038 Tue Mar 24 18:56:57 2009
600 31.clamd Status:DISABLED
601 40.vsftpd Status:OK Duration:0.045 Tue Mar 24 18:56:57 2009
602 41.httpd Status:OK Duration:0.039 Tue Mar 24 18:56:57 2009
603 50.samba Status:ERROR Duration:0.082 Tue Mar 24 18:56:57 2009
604 OUTPUT:ERROR: Samba tcp port 445 is not responding
610 <title>disablescript <parameter>SCRIPT</parameter></title>
612 This command is used to disable an eventscript.
615 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'.
620 <title>enablescript <parameter>SCRIPT</parameter></title>
622 This command is used to enable an eventscript.
625 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'.
630 <title>listvars</title>
632 List all tuneable variables, except the values of the obsolete tunables
633 like VacuumMinInterval. The obsolete tunables can be retrieved only
634 explicitly with the "ctdb getvar" command.
637 <title>Example</title>
640 SeqnumInterval = 1000
643 KeepaliveInterval = 5
650 TickleUpdateInterval = 20
651 EventScriptTimeout = 30
652 MonitorTimeoutCount = 20
653 RecoveryGracePeriod = 120
654 RecoveryBanPeriod = 300
655 DatabaseHashSize = 100001
657 RerecoveryTimeout = 10
662 DisableIPFailover = 0
663 VerboseMemoryNames = 0
667 RecLockLatencyMs = 1000
668 RecoveryDropAllIPs = 120
670 VacuumMaxRunTime = 120
673 VacuumFastPathCount = 60
674 MaxQueueDropMsg = 1000000
675 AllowUnhealthyDBRead = 0
676 StatHistoryInterval = 1
677 DeferredAttachTO = 120
678 AllowClientDBAttach = 1
679 RecoverPDBBySeqNum = 1
680 DeferredRebalanceOnNodeAdd = 300
682 HopcountMakeSticky = 50
686 DBRecordCountWarn = 100000
687 DBRecordSizeWarn = 10000000
688 DBSizeWarn = 100000000
689 PullDBPreallocation = 10485760
690 NoIPHostOnAllDisabled = 0
691 Samba3AvoidDeadlocks = 0
693 LockProcessesPerDB = 200
699 <title>getvar <parameter>NAME</parameter></title>
701 Get the runtime value of a tuneable variable.
704 <title>Example</title>
706 # ctdb getvar MonitorInterval
713 <title>setvar <parameter>NAME</parameter> <parameter>VALUE</parameter></title>
715 Set the runtime value of a tuneable variable.
718 <title>Example</title>
720 # ctdb setvar MonitorInterval 20
726 <title>lvsmaster</title>
728 This command shows which node is currently the LVSMASTER. The
729 LVSMASTER is the node in the cluster which drives the LVS system and
730 which receives all incoming traffic from clients.
733 LVS is the mode where the entire CTDB/Samba cluster uses a single
734 ip address for the entire cluster. In this mode all clients connect to
735 one specific node which will then multiplex/loadbalance the clients
736 evenly onto the other nodes in the cluster. This is an alternative to using
737 public ip addresses. See the manpage for ctdbd for more information
745 This command shows which nodes in the cluster are currently active in the
746 LVS configuration. I.e. which nodes we are currently loadbalancing
747 the single ip address across.
751 LVS will by default only loadbalance across those nodes that are both
752 LVS capable and also HEALTHY. Except if all nodes are UNHEALTHY in which
753 case LVS will loadbalance across all UNHEALTHY nodes as well.
754 LVS will never use nodes that are DISCONNECTED, STOPPED, BANNED or
770 <title>getcapabilities</title>
773 This command shows the capabilities of the current node. See
774 the <citetitle>CAPABILITIES</citetitle> section in
775 <citerefentry><refentrytitle>ctdb</refentrytitle>
776 <manvolnum>7</manvolnum></citerefentry> for more details.
791 <title>statistics</title>
793 Collect statistics from the CTDB daemon about
794 how many calls it has served. Information about
795 various fields in statistics can be found in
796 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
797 <manvolnum>7</manvolnum></citerefentry>.
800 <title>Example</title>
804 Current time of statistics : Tue Mar 8 15:18:51 2016
805 Statistics collected since : (003 21:31:32) Fri Mar 4 17:47:19 2016
810 client_packets_sent 8170534
811 client_packets_recv 7166132
812 node_packets_sent 16549998
813 node_packets_recv 5244418
814 keepalive_packets_sent 201969
815 keepalive_packets_recv 201969
824 reply_control 6831284
841 pending_childwrite_calls 0
844 total_ro_delegations 0
846 hop_count_buckets: 8 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
847 lock_buckets: 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0
848 locks_latency MIN/AVG/MAX 0.010005/0.010418/0.011010 sec out of 8
849 reclock_ctdbd MIN/AVG/MAX 0.002538/0.002538/0.002538 sec out of 1
850 reclock_recd MIN/AVG/MAX 0.000000/0.000000/0.000000 sec out of 0
851 call_latency MIN/AVG/MAX 0.000044/0.002142/0.011702 sec out of 15
852 childwrite_latency MIN/AVG/MAX 0.000000/0.000000/0.000000 sec out of 0
858 <title>statisticsreset</title>
860 This command is used to clear all statistics counters in a node.
863 Example: ctdb statisticsreset
868 <title>dbstatistics <parameter>DB</parameter></title>
870 Display statistics about the database DB. Information
871 about various fields in dbstatistics can be found in
872 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
873 <manvolnum>7</manvolnum></citerefentry>.
876 <title>Example</title>
878 # ctdb dbstatistics locking.tdb
879 DB Statistics: locking.tdb
887 hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
888 lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
889 locks_latency MIN/AVG/MAX 0.001066/0.012686/4.202292 sec out of 14356
890 vacuum_latency MIN/AVG/MAX 0.000472/0.002207/15.243570 sec out of 224530
892 Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
898 <title>getreclock</title>
900 Show the name of the recovery lock file, if any.
907 Reclock file:/clusterfs/.ctdb/recovery.lock
914 setreclock <optional><parameter>FILE</parameter></optional>
918 FILE specifies the name of the recovery lock file. If the
919 recovery lock file is changed at run-time then this will cause
920 a recovery, which in turn causes the recovery lock to be
925 If no FILE is specified then a recovery lock file will no
930 This command only affects the run-time setting of a single
931 CTDB node. This setting <emphasis>must</emphasis> be changed
932 on all nodes simultaneously. For information about configuring
933 the recovery lock file please see the
934 <citetitle>CTDB_RECOVERY_LOCK</citetitle> entry in
935 <citerefentry><refentrytitle>ctdbd.conf</refentrytitle>
936 <manvolnum>5</manvolnum></citerefentry> and the
937 <citetitle>--reclock</citetitle> entry in
938 <citerefentry><refentrytitle>ctdbd</refentrytitle>
939 <manvolnum>1</manvolnum></citerefentry>. For information
940 about the recovery lock please see the <citetitle>RECOVERY
941 LOCK</citetitle> section in
942 <citerefentry><refentrytitle>ctdb</refentrytitle>
943 <manvolnum>7</manvolnum></citerefentry>.
950 <title>getdebug</title>
952 Get the current debug level for the node. the debug level controls what information is written to the log file.
955 The debug levels are mapped to the corresponding syslog levels.
956 When a debug level is set, only those messages at that level and higher
957 levels will be printed.
960 The list of debug levels from highest to lowest are :
963 ERR WARNING NOTICE INFO DEBUG
968 <title>setdebug <parameter>DEBUGLEVEL</parameter></title>
970 Set the debug level of a node. This controls what information will be logged.
973 The debuglevel is one of ERR WARNING NOTICE INFO DEBUG
978 <title>getpid</title>
980 This command will return the process id of the ctdb daemon.
985 <title>disable</title>
987 This command is used to administratively disable a node in the cluster.
988 A disabled node will still participate in the cluster and host
989 clustered TDB records but its public ip address has been taken over by
990 a different node and it no longer hosts any services.
995 <title>enable</title>
997 Re-enable a node that has been administratively disabled.
1004 This command is used to administratively STOP a node in the cluster.
1005 A STOPPED node is connected to the cluster but will not host any
1006 public ip addresse, nor does it participate in the VNNMAP.
1007 The difference between a DISABLED node and a STOPPED node is that
1008 a STOPPED node does not host any parts of the database which means
1009 that a recovery is required to stop/continue nodes.
1014 <title>continue</title>
1016 Re-start a node that has been administratively stopped.
1021 <title>addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter></title>
1023 This command is used to add a new public ip to a node during runtime.
1024 This allows public addresses to be added to a cluster without having
1025 to restart the ctdb daemons.
1028 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.
1029 If you want this change to be permanent you must also update the public addresses file manually.
1034 <title>delip <parameter>IPADDR</parameter></title>
1036 This command is used to remove a public ip from a node during runtime.
1037 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.
1040 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.
1041 If you want this change to be permanent you must also update the public addresses file manually.
1046 <title>moveip <parameter>IPADDR</parameter> <parameter>PNN</parameter></title>
1048 This command can be used to manually fail a public ip address to a
1052 In order to manually override the "automatic" distribution of public
1053 ip addresses that ctdb normally provides, this command only works
1054 when you have changed the tunables for the daemon to:
1057 DeterministicIPs = 0
1065 <title>shutdown</title>
1067 This command will shutdown a specific CTDB daemon.
1072 <title>setlmasterrole on|off</title>
1074 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.
1078 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.
1081 Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
1084 See also "ctdb getcapabilities"
1089 <title>setrecmasterrole on|off</title>
1091 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.
1095 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.
1098 See also "ctdb getcapabilities"
1103 <title>reloadnodes</title>
1105 This command is used when adding new nodes, or removing
1106 existing nodes from an existing cluster.
1109 Procedure to add nodes:
1114 To expand an existing cluster, first ensure with
1115 <command>ctdb status</command> that all nodes are up and
1116 running and that they are all healthy. Do not try to
1117 expand a cluster unless it is completely healthy!
1122 On all nodes, edit <filename>/usr/local/etc/ctdb/nodes</filename>
1123 and <emphasis>add the new nodes at the end of this
1129 Verify that all the nodes have identical
1130 <filename>/usr/local/etc/ctdb/nodes</filename> files after adding
1136 Run <command>ctdb reloadnodes</command> to force all nodes
1137 to reload the nodes file.
1142 Use <command>ctdb status</command> on all nodes and verify
1143 that they now show the additional nodes.
1148 Install and configure the new node and bring it online.
1153 Procedure to remove nodes:
1158 To remove nodes from an existing cluster, first ensure
1159 with <command>ctdb status</command> that all nodes, except
1160 the node to be deleted, are up and running and that they
1161 are all healthy. Do not try to remove nodes from a
1162 cluster unless the cluster is completely healthy!
1167 Shutdown and power off the node to be removed.
1172 On all other nodes, edit the
1173 <filename>/usr/local/etc/ctdb/nodes</filename> file and
1174 <emphasis>comment out</emphasis> the nodes to be removed.
1175 <emphasis>Do not delete the lines for the deleted
1176 nodes</emphasis>, just comment them out by adding a '#' at
1177 the beginning of the lines.
1182 Run <command>ctdb reloadnodes</command> to force all nodes
1183 to reload the nodes file.
1188 Use <command>ctdb status</command> on all nodes and verify
1189 that the deleted nodes are no longer listed.
1199 <optional><parameter>PNN-LIST</parameter></optional>
1202 This command reloads the public addresses configuration file
1203 on the specified nodes. When it completes addresses will be
1204 reconfigured and reassigned across the cluster as necessary.
1209 <title>getdbmap</title>
1211 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.
1214 If a PERSISTENT database is not in a healthy state the database is
1215 flagged as UNHEALTHY. If there's at least one completely healthy node running in
1216 the cluster, it's possible that the content is restored by a recovery
1217 run automaticly. Otherwise an administrator needs to analyze the
1221 See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1222 "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1223 and (if samba or tdb-utils are installed) "tdbtool check".
1226 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.
1230 <title>Example</title>
1233 Number of databases:10
1234 dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
1235 dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
1236 dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
1237 dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
1238 dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
1239 dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
1240 dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1241 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
1242 dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1243 dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
1245 # ctdb getdbmap # example for unhealthy database
1246 Number of databases:1
1247 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1250 |ID|Name|Path|Persistent|Unhealthy|
1251 |0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
1259 <parameter>DB</parameter>
1260 <parameter>FILE</parameter>
1263 Copy the contents of database DB to FILE. FILE can later be
1264 read back using <command>restoredb</command>. This is mainly
1265 useful for backing up persistent databases such as
1266 <filename>secrets.tdb</filename> and similar.
1273 <parameter>FILE</parameter>
1274 <optional><parameter>DB</parameter></optional>
1277 This command restores a persistent database that was
1278 previously backed up using backupdb. By default the data will
1279 be restored back into the same database as it was created
1280 from. By specifying dbname you can restore the data into a
1286 <title>setdbreadonly <parameter>DB</parameter></title>
1288 This command will enable the read-only record support for a
1289 database. This is an experimental feature to improve
1290 performance for contended records primarily in locking.tdb and
1291 brlock.tdb. When enabling this feature you must set it on all
1292 nodes in the cluster.
1297 <title>setdbsticky <parameter>DB</parameter></title>
1299 This command will enable the sticky record support for the
1300 specified database. This is an experimental feature to
1301 improve performance for contended records primarily in
1302 locking.tdb and brlock.tdb. When enabling this feature you
1303 must set it on all nodes in the cluster.
1310 <title>INTERNAL COMMANDS</title>
1313 Internal commands are used by CTDB's scripts and are not
1314 required for managing a CTDB cluster. Their parameters and
1315 behaviour are subject to change.
1319 <title>gettickles <parameter>IPADDR</parameter></title>
1321 Show TCP connections that are registered with CTDB to be
1322 "tickled" if there is a failover.
1327 <title>gratiousarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1329 Send out a gratious ARP for the specified interface through
1330 the specified interface. This command is mainly used by the
1336 <title>killtcp</title>
1338 Read a list of TCP connections, one per line, from standard
1339 input and terminate each connection. A connection is
1343 <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1346 Each connection is terminated by issuing a TCP RST to the
1347 SRC-IPADDR:SRC-PORT endpoint.
1350 A single connection can be specified on the command-line
1351 rather than on standard input.
1357 pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1366 pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1369 Print the value associated with KEY in DB.
1376 <parameter>DB</parameter>
1377 <parameter>KEY</parameter>
1378 <parameter>FILE</parameter>
1381 Store KEY in DB with contents of FILE as the associated value.
1388 <parameter>DB</parameter>
1389 <optional><parameter>FILE</parameter></optional>
1392 Read a list of key-value pairs, one per line from FILE, and
1393 store them in DB using a single transaction. An empty value
1394 is equivalent to deleting the given key.
1397 The key and value should be separated by spaces or tabs. Each
1398 key/value should be a printable string enclosed in
1404 <title>runstate [setup|first_recovery|startup|running]</title>
1406 Print the runstate of the specified node. Runstates are used
1407 to serialise important state transitions in CTDB, particularly
1411 If one or more optional runstate arguments are specified then
1412 the node must be in one of these runstates for the command to
1416 <title>Example</title>
1425 <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1427 Set the internal state of network interface IFACE. This is
1428 typically used in the <filename>10.interface</filename> script
1429 in the "monitor" event.
1432 Example: ctdb setifacelink eth0 up
1437 <title>tickle <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter></title>
1439 Send a TCP tickle to the source host for the specified TCP
1440 connection. A TCP tickle is a TCP ACK packet with an invalid
1441 sequence and acknowledge number and will when received by the
1442 source host result in it sending an immediate correct ACK back
1446 TCP tickles are useful to "tickle" clients after a IP failover has
1447 occured since this will make the client immediately recognize the
1448 TCP connection has been disrupted and that the client will need
1449 to reestablish. This greatly speeds up the time it takes for a client
1450 to detect and reestablish after an IP failover in the ctdb cluster.
1455 <title>version</title>
1457 Display the CTDB version.
1464 <title>DEBUGGING COMMANDS</title>
1466 These commands are primarily used for CTDB development and testing and
1467 should not be used for normal administration.
1472 <title>OPTIONS</title>
1475 <varlistentry><term>--print-emptyrecords</term>
1478 This enables printing of empty records when dumping databases
1479 with the catdb, cattbd and dumpdbbackup commands. Records with
1480 empty data segment are considered deleted by ctdb and cleaned
1481 by the vacuuming mechanism, so this switch can come in handy for
1482 debugging the vacuuming behaviour.
1487 <varlistentry><term>--print-datasize</term>
1490 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1491 size of the record data instead of dumping the data contents.
1496 <varlistentry><term>--print-lmaster</term>
1499 This lets catdb print the lmaster for each record.
1504 <varlistentry><term>--print-hash</term>
1507 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1508 hash for each record.
1513 <varlistentry><term>--print-recordflags</term>
1516 This lets catdb and dumpdbbackup print the
1517 record flags for each record. Note that cattdb always
1527 <title>process-exists <parameter>PID</parameter></title>
1529 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.
1534 <title>getdbstatus <parameter>DB</parameter></title>
1536 This command displays more details about a database.
1539 <title>Example</title>
1541 # ctdb getdbstatus test.tdb.0
1544 path: /usr/local/var/lib/ctdb/test.tdb.0
1548 # ctdb getdbstatus registry.tdb # with a corrupted TDB
1551 path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
1553 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1559 <title>catdb <parameter>DB</parameter></title>
1561 Print a dump of the clustered TDB database DB.
1566 <title>cattdb <parameter>DB</parameter></title>
1568 Print a dump of the contents of the local TDB database DB.
1573 <title>dumpdbbackup <parameter>FILE</parameter></title>
1575 Print a dump of the contents from database backup FILE,
1576 similar to <command>catdb</command>.
1581 <title>wipedb <parameter>DB</parameter></title>
1583 Remove all contents of database DB.
1588 <title>recover</title>
1590 This command will trigger the recovery daemon to do a cluster
1596 <title>ipreallocate, sync</title>
1598 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.
1603 <title>getmonmode</title>
1605 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.
1608 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.
1611 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.
1617 <title>setmonmode 0|1</title>
1619 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.
1624 <title>attach <parameter>DBNAME</parameter> [persistent]</title>
1626 Create a new CTDB database called DBNAME and attach to it on
1632 <title>detach <parameter>DB-LIST</parameter></title>
1634 Detach specified non-persistent database(s) from the cluster. This
1635 command will disconnect specified database(s) on all nodes in
1636 the cluster. This command should only be used when none of the
1637 specified database(s) are in use.
1640 All nodes should be active and tunable AllowClientDBAccess should
1641 be disabled on all nodes before detaching databases.
1646 <title>dumpmemory</title>
1648 This is a debugging command. This command will make the ctdb
1649 daemon to write a fill memory allocation map to standard output.
1654 <title>rddumpmemory</title>
1656 This is a debugging command. This command will dump the talloc memory
1657 allocation tree for the recovery daemon to standard output.
1664 Thaw a previously frozen node.
1670 <title>eventscript <parameter>ARGUMENTS</parameter></title>
1672 This is a debugging command. This command can be used to manually
1673 invoke and run the eventscritps with arbitrary arguments.
1678 <title>ban <parameter>BANTIME</parameter></title>
1680 Administratively ban a node for BANTIME seconds. The node
1681 will be unbanned after BANTIME seconds have elapsed.
1684 A banned node does not participate in the cluster. It does
1685 not host any records for the clustered TDB and does not host
1686 any public IP addresses.
1689 Nodes are automatically banned if they misbehave. For
1690 example, a node may be banned if it causes too many cluster
1694 To administratively exclude a node from a cluster use the
1695 <command>stop</command> command.
1700 <title>unban</title>
1702 This command is used to unban a node that has either been
1703 administratively banned using the ban command or has been
1704 automatically banned.
1711 <optional><parameter>PNN-LIST</parameter></optional>
1714 This command marks the given nodes as rebalance targets in the
1715 LCP2 IP allocation algorithm. The
1716 <command>reloadips</command> command will do this as necessary
1717 so this command should not be needed.
1722 <title>check_srvids <parameter>SRVID</parameter> ...</title>
1724 This command checks whether a set of srvid message ports are
1725 registered on the node or not. The command takes a list of
1729 <title>Example</title>
1731 # ctdb check_srvids 1 2 3 14765
1732 Server id 0:1 does not exist
1733 Server id 0:2 does not exist
1734 Server id 0:3 does not exist
1735 Server id 0:14765 exists
1742 <!-- UNDOCUMENTED: showban stats disablemonitor enablemonitor
1743 isnotrecmaster addtickle deltickle regsrvid unregsrvid chksrvid
1744 getsrvids rebalanceip setdbprio getdbprio msglisten msgsend
1745 tfetch tstore readkey writekey
1746 checktcpport getdbseqnum ipiface
1750 <title>SEE ALSO</title>
1752 <citerefentry><refentrytitle>ctdbd</refentrytitle>
1753 <manvolnum>1</manvolnum></citerefentry>,
1755 <citerefentry><refentrytitle>onnode</refentrytitle>
1756 <manvolnum>1</manvolnum></citerefentry>,
1758 <citerefentry><refentrytitle>ctdb</refentrytitle>
1759 <manvolnum>7</manvolnum></citerefentry>,
1761 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1762 <manvolnum>7</manvolnum></citerefentry>,
1764 <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1765 <manvolnum>7</manvolnum></citerefentry>,
1767 <ulink url="http://ctdb.samba.org/"/>