1 <?xml version="1.0" encoding="UTF-8"?>
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</parameter></term>
129 The node specified by PNN 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 usage information to the screen.
206 <varlistentry><term>-d --debug=<parameter>DEBUGLEVEL</parameter></term>
209 Change the debug level for the command. Default is NOTICE.
218 <title>ADMINISTRATIVE COMMANDS</title>
220 These are commands used to monitor and administer a CTDB cluster.
226 This command displays the PNN of the current node.
231 <title>status</title>
233 This command shows the current status of all CTDB nodes based
234 on information from the queried node.
238 Note: If the queried node is INACTIVE then the status
239 might not be current.
243 <title>Node status</title>
245 This includes the number of physical nodes and the status of
246 each node. See <citerefentry><refentrytitle>ctdb</refentrytitle>
247 <manvolnum>7</manvolnum></citerefentry> for information
253 <title>Generation</title>
255 The generation id is a number that indicates the current generation
256 of a cluster instance. Each time a cluster goes through a
257 reconfiguration or a recovery its generation id will be changed.
260 This number does not have any particular meaning other than
261 to keep track of when a cluster has gone through a
262 recovery. It is a random number that represents the current
263 instance of a ctdb cluster and its databases. The CTDB
264 daemon uses this number internally to be able to tell when
265 commands to operate on the cluster and the databases was
266 issued in a different generation of the cluster, to ensure
267 that commands that operate on the databases will not survive
268 across a cluster database recovery. After a recovery, all
269 old outstanding commands will automatically become invalid.
272 Sometimes this number will be shown as "INVALID". This only means that
273 the ctdbd daemon has started but it has not yet merged with the cluster through a recovery.
274 All nodes start with generation "INVALID" and are not assigned a real
275 generation id until they have successfully been merged with a cluster
281 <title>Virtual Node Number (VNN) map</title>
283 Consists of the number of virtual nodes and mapping from
284 virtual node numbers to physical node numbers. Only nodes
285 that are participating in the VNN map can become lmaster for
291 <title>Recovery mode</title>
293 This is the current recovery mode of the cluster. There are two possible modes:
296 NORMAL - The cluster is fully operational.
299 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.
302 Once the leader detects an inconsistency, for example a node
303 becomes disconnected/connected, the recovery daemon will trigger a
304 cluster recovery process, where all databases are remerged across the
305 cluster. When this process starts, the leader will first
306 "freeze" all databases to prevent applications such as samba from
307 accessing the databases and it will also mark the recovery mode as
311 When the CTDB daemon starts up, it will start in RECOVERY
312 mode. Once the node has been merged into a cluster and all
313 databases have been recovered, the node mode will change into
314 NORMAL mode and the databases will be "thawed", allowing samba
315 to access the databases again.
319 <title>Leader</title>
321 This is the cluster node that is currently designated as the
322 leader. This node is responsible of monitoring the
323 consistency of the cluster and to perform the actual
324 recovery process when required.
327 Only one node at a time can be the designated leader. Which
328 node is designated the leader is decided by an election
329 process in the recovery daemons running on each node.
334 <title>Example</title>
338 pnn:0 192.168.2.200 OK (THIS NODE)
339 pnn:1 192.168.2.201 OK
340 pnn:2 192.168.2.202 OK
341 pnn:3 192.168.2.203 OK
342 Generation:1362079228
348 Recovery mode:NORMAL (0)
355 <title>nodestatus <optional><parameter>PNN-LIST</parameter></optional></title>
357 This command is similar to the <command>status</command>
358 command. It displays the "node status" subset of output. The
359 main differences are:
365 The exit code is the bitwise-OR of the flags for each
366 specified node, while <command>ctdb status</command> exits
367 with 0 if it was able to retrieve status for all nodes.
373 <command>ctdb status</command> provides status information
374 for all nodes. <command>ctdb nodestatus</command>
375 defaults to providing status for only the current node.
376 If PNN-LIST is provided then status is given for
377 the indicated node(s).
383 A common invocation in scripts is <command>ctdb nodestatus
384 all</command> to check whether all nodes in a cluster are
389 <title>Example</title>
392 pnn:0 10.0.0.30 OK (THIS NODE)
394 # ctdb nodestatus all
396 pnn:0 10.0.0.30 OK (THIS NODE)
403 <title>leader</title>
405 This command shows the pnn of the node which is currently the leader.
409 Note: If the queried node is INACTIVE then the status
410 might not be current.
415 <title>uptime</title>
417 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.
421 <title>Example</title>
424 Current time of node : Thu Oct 29 10:38:54 2009
425 Ctdbd start time : (000 16:54:28) Wed Oct 28 17:44:26 2009
426 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
427 Duration of last recovery/failover: 2.248552 seconds
433 <title>listnodes</title>
435 This command shows lists the ip addresses of all the nodes in the cluster.
439 <title>Example</title>
451 <title>natgw {leader|list|status}</title>
453 This command shows different aspects of NAT gateway status.
454 For an overview of CTDB's NAT gateway functionality please see
455 the <citetitle>NAT GATEWAY</citetitle> section in
456 <citerefentry><refentrytitle>ctdb</refentrytitle>
457 <manvolnum>7</manvolnum></citerefentry>.
465 Show the PNN and private IP address of the current NAT
480 List the private IP addresses of nodes in the current
481 NAT gateway group, annotating the leader node.
498 List the nodes in the current NAT gateway group and
505 pnn:0 192.168.2.200 UNHEALTHY (THIS NODE)
506 pnn:1 192.168.2.201 OK
507 pnn:2 192.168.2.202 OK
508 pnn:3 192.168.2.203 OK
518 This command will "ping" specified CTDB nodes in the cluster
519 to verify that they are running.
522 <title>Example</title>
525 response from 0 time=0.000054 sec (3 clients)
531 <title>ifaces</title>
533 This command will display the list of network interfaces, which could
534 host public addresses, along with their status.
537 <title>Example</title>
541 name:eth5 link:up references:2
542 name:eth4 link:down references:0
543 name:eth3 link:up references:1
544 name:eth2 link:up references:1
547 |Name|LinkStatus|References|
559 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".
562 <title>Example</title>
566 172.31.91.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
567 172.31.91.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
568 172.31.91.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
569 172.31.91.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
570 172.31.92.82 node[1] active[] available[eth5] configured[eth4,eth5]
571 172.31.92.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
572 172.31.92.84 node[1] active[] available[eth5] configured[eth4,eth5]
573 172.31.92.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
576 |Public IP|Node|ActiveInterface|AvailableInterfaces|ConfiguredInterfaces|
577 |172.31.91.82|1||eth2,eth3|eth2,eth3|
578 |172.31.91.83|0|eth3|eth2,eth3|eth2,eth3|
579 |172.31.91.84|1||eth2,eth3|eth2,eth3|
580 |172.31.91.85|0|eth2|eth2,eth3|eth2,eth3|
581 |172.31.92.82|1||eth5|eth4,eth5|
582 |172.31.92.83|0|eth5|eth5|eth4,eth5|
583 |172.31.92.84|1||eth5|eth4,eth5|
584 |172.31.92.85|0|eth5|eth5|eth4,eth5|
590 <title>ipinfo <parameter>IP</parameter></title>
592 This command will display details about the specified public addresses.
595 <title>Example</title>
597 # ctdb ipinfo 172.31.92.85
598 Public IP[172.31.92.85] info on node 0
602 Interface[1]: Name:eth4 Link:down References:0
603 Interface[2]: Name:eth5 Link:up References:2 (active)
609 <title>event run|status|script list|script enable|script disable</title>
611 This command is used to control event daemon and to inspect
612 status of various events.
616 The commands below require a component to be specified. In
617 the current version the only valid component is
618 <literal>legacy</literal>.
623 <term>run <parameter>TIMEOUT</parameter> <parameter>COMPONENT</parameter> <parameter>EVENT</parameter> <optional><parameter>ARGUMENTS</parameter></optional> </term>
626 This command can be used to manually run specified EVENT
627 in COMPONENT with optional ARGUMENTS. The event will be
628 allowed to run a maximum of TIMEOUT seconds. If TIMEOUT
629 is 0, then there is no time limit for running the event.
635 <term>status <parameter>COMPONENT</parameter> <parameter>EVENT</parameter></term>
638 This command displays the last execution status of the
639 specified EVENT in COMPONENT.
642 The command will terminate with the exit status
643 corresponding to the overall status of event that is
647 The output is the list of event scripts executed.
648 Each line shows the name, status, duration and start time
649 for each script. Output from each script is shown.
655 # ctdb event status legacy monitor
656 00.ctdb OK 0.014 Sat Apr 15 19:39:11 2024
657 01.reclock OK 0.013 Sat Apr 15 19:39:11 2024
658 05.system OK 0.029 Sat Apr 15 19:39:11 2024
659 10.interface OK 0.037 Sat Apr 15 19:39:11 2024
660 11.natgw OK 0.011 Sat Apr 15 19:39:11 2024
661 11.routing OK 0.007 Sat Apr 15 19:39:11 2024
662 13.per_ip_routing OK 0.007 Sat Apr 15 19:39:11 2024
663 20.multipathd OK 0.007 Sat Apr 15 19:39:11 2024
664 31.clamd OK 0.007 Sat Apr 15 19:39:11 2024
665 40.vsftpd OK 0.013 Sat Apr 15 19:39:11 2024
666 41.httpd OK 0.018 Sat Apr 15 19:39:11 2024
667 49.winbind OK 0.023 Sat Apr 15 19:39:11 2024
668 50.samba OK 0.100 Sat Apr 15 19:39:12 2024
669 60.nfs OK 0.376 Sat Apr 15 19:39:12 2024
670 70.iscsi OK 0.009 Sat Apr 15 19:39:12 2024
671 91.lvs OK 0.007 Sat Apr 15 19:39:12 2024
672 95.database OK 0.009 Sat Apr 15 19:39:12 2024
679 # ctdb event status legacy monitor
680 00.ctdb OK 0.011 Sat Apr 15 19:40:46 2024
681 01.reclock OK 0.010 Sat Apr 15 19:40:46 2024
682 05.system OK 0.030 Sat Apr 15 19:40:46 2024
683 10.interface OK 0.041 Sat Apr 15 19:40:46 2024
684 11.natgw OK 0.008 Sat Apr 15 19:40:46 2024
685 11.routing OK 0.007 Sat Apr 15 19:40:46 2024
686 13.per_ip_routing OK 0.007 Sat Apr 15 19:40:46 2024
687 20.multipathd OK 0.007 Sat Apr 15 19:40:46 2024
688 31.clamd OK 0.007 Sat Apr 15 19:40:46 2024
689 40.vsftpd OK 0.013 Sat Apr 15 19:40:46 2024
690 41.httpd OK 0.015 Sat Apr 15 19:40:46 2024
691 49.winbind OK 0.022 Sat Apr 15 19:40:46 2024
692 50.samba ERROR 0.077 Sat Apr 15 19:40:46 2024
693 OUTPUT: ERROR: samba tcp port 445 is not responding
699 <term>script list <parameter>COMPONENT</parameter></term>
702 List the available event scripts in COMPONENT. Enabled
703 scripts are flagged with a '*'.
706 Generally, event scripts are provided by CTDB. However,
707 local or 3rd party event scripts may also be available.
708 These are shown in a separate section after those
715 # ctdb event script list legacy
740 <term>script enable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
743 Enable the specified event SCRIPT in COMPONENT. Only
744 enabled scripts will be executed when running any event.
750 <term>script disable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
753 Disable the specified event SCRIPT in COMPONENT. This
754 will prevent the script from executing when running any
763 <title>scriptstatus</title>
765 This is an alias for <command>ctdb event status legacy
766 <optional>EVENT</optional></command>, where EVENT defaults to
767 <command>monitor</command>.
770 This command is deprecated. It's provided for backward
771 compatibility. Use <command>ctdb event status</command>
777 <title>listvars</title>
779 List all tuneable variables, except the values of the obsolete tunables
780 like VacuumMinInterval. The obsolete tunables can be retrieved only
781 explicitly with the "ctdb getvar" command.
784 <title>Example</title>
787 SeqnumInterval = 1000
790 KeepaliveInterval = 5
797 TickleUpdateInterval = 20
798 EventScriptTimeout = 30
799 MonitorTimeoutCount = 20
800 RecoveryGracePeriod = 120
801 RecoveryBanPeriod = 300
802 DatabaseHashSize = 100001
804 RerecoveryTimeout = 10
807 VerboseMemoryNames = 0
811 RecLockLatencyMs = 1000
812 RecoveryDropAllIPs = 120
814 VacuumMaxRunTime = 120
816 VacuumFastPathCount = 60
817 MaxQueueDropMsg = 1000000
818 AllowUnhealthyDBRead = 0
819 StatHistoryInterval = 1
820 DeferredAttachTO = 120
821 AllowClientDBAttach = 1
822 RecoverPDBBySeqNum = 1
823 DeferredRebalanceOnNodeAdd = 300
825 HopcountMakeSticky = 50
829 DBRecordCountWarn = 100000
830 DBRecordSizeWarn = 10000000
831 DBSizeWarn = 100000000
832 PullDBPreallocation = 10485760
833 LockProcessesPerDB = 200
834 RecBufferSizeLimit = 1000000
835 QueueBufferSize = 1024
842 <title>getvar <parameter>NAME</parameter></title>
844 Get the runtime value of a tuneable variable.
847 <title>Example</title>
849 # ctdb getvar MonitorInterval
856 <title>setvar <parameter>NAME</parameter> <parameter>VALUE</parameter></title>
858 Set the runtime value of a tuneable variable.
861 <title>Example</title>
863 # ctdb setvar MonitorInterval 20
869 <title>lvs {leader|list|status}</title>
871 This command shows different aspects of LVS status. For an
872 overview of CTDB's LVS functionality please see the
873 <citetitle>LVS</citetitle> section in
874 <citerefentry><refentrytitle>ctdb</refentrytitle>
875 <manvolnum>7</manvolnum></citerefentry>.
883 Shows the PNN of the current LVS leader node.
897 Lists the currently usable LVS nodes.
912 List the nodes in the current LVS group and their status.
918 pnn:0 10.0.0.11 UNHEALTHY (THIS NODE)
919 pnn:1 10.0.0.12 UNHEALTHY
931 <title>getcapabilities</title>
934 This command shows the capabilities of the current node. See
935 the <citetitle>CAPABILITIES</citetitle> section in
936 <citerefentry><refentrytitle>ctdb</refentrytitle>
937 <manvolnum>7</manvolnum></citerefentry> for more details.
951 <title>statistics</title>
953 Collect statistics from the CTDB daemon about
954 how many calls it has served. Information about
955 various fields in statistics can be found in
956 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
957 <manvolnum>7</manvolnum></citerefentry>.
960 <title>Example</title>
964 Current time of statistics : Tue Mar 8 15:18:51 2016
965 Statistics collected since : (003 21:31:32) Fri Mar 4 17:47:19 2016
970 client_packets_sent 8170534
971 client_packets_recv 7166132
972 node_packets_sent 16549998
973 node_packets_recv 5244418
974 keepalive_packets_sent 201969
975 keepalive_packets_recv 201969
984 reply_control 6831284
1001 pending_childwrite_calls 0
1004 total_ro_delegations 0
1006 hop_count_buckets: 8 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1007 lock_buckets: 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0
1008 locks_latency MIN/AVG/MAX 0.010005/0.010418/0.011010 sec out of 8
1009 reclock_ctdbd MIN/AVG/MAX 0.002538/0.002538/0.002538 sec out of 1
1010 reclock_recd MIN/AVG/MAX 0.000000/0.000000/0.000000 sec out of 0
1011 call_latency MIN/AVG/MAX 0.000044/0.002142/0.011702 sec out of 15
1012 childwrite_latency MIN/AVG/MAX 0.000000/0.000000/0.000000 sec out of 0
1018 <title>statisticsreset</title>
1020 This command is used to clear all statistics counters in a node.
1023 Example: ctdb statisticsreset
1028 <title>dbstatistics <parameter>DB</parameter></title>
1030 Display statistics about the database DB. Information
1031 about various fields in dbstatistics can be found in
1032 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1033 <manvolnum>7</manvolnum></citerefentry>.
1036 <title>Example</title>
1038 # ctdb dbstatistics locking.tdb
1039 DB Statistics: locking.tdb
1047 hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1048 lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
1049 locks_latency MIN/AVG/MAX 0.001066/0.012686/4.202292 sec out of 14356
1050 vacuum_latency MIN/AVG/MAX 0.000472/0.002207/15.243570 sec out of 224530
1052 Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
1058 <title>getreclock</title>
1060 Show details of the recovery lock, if any.
1067 /clusterfs/.ctdb/recovery.lock
1073 <title>getdebug</title>
1075 Get the current debug level for the node. the debug level controls what information is written to the log file.
1078 The debug levels are mapped to the corresponding syslog levels.
1079 When a debug level is set, only those messages at that level and higher
1080 levels will be printed.
1083 The list of debug levels from highest to lowest are :
1086 ERROR WARNING NOTICE INFO DEBUG
1091 <title>setdebug <parameter>DEBUGLEVEL</parameter></title>
1093 Set the debug level of a node. This controls what information will be logged.
1096 The debuglevel is one of ERROR WARNING NOTICE INFO DEBUG
1101 <title>getpid</title>
1103 This command will return the process id of the ctdb daemon.
1108 <title>disable</title>
1110 This command is used to administratively disable a node in the cluster.
1111 A disabled node will still participate in the cluster and host
1112 clustered TDB records but its public ip address has been taken over by
1113 a different node and it no longer hosts any services.
1118 <title>enable</title>
1120 Re-enable a node that has been administratively disabled.
1127 This command is used to administratively STOP a node in the cluster.
1128 A STOPPED node is connected to the cluster but will not host any
1129 public ip addresses, nor does it participate in the VNNMAP.
1130 The difference between a DISABLED node and a STOPPED node is that
1131 a STOPPED node does not host any parts of the database which means
1132 that a recovery is required to stop/continue nodes.
1137 <title>continue</title>
1139 Re-start a node that has been administratively stopped.
1144 <title>addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter></title>
1146 This command is used to add a new public ip to a node
1147 during runtime. It should be followed by a <command>ctdb
1148 ipreallocate</command>. This allows public addresses to be
1149 added to a cluster without having to restart the ctdb daemons.
1152 Note that this only updates the runtime instance of ctdb. Any
1153 changes will be lost next time ctdb is restarted and the public
1154 addresses file is re-read. If you want this change to be
1155 permanent you must also update the public addresses file manually.
1160 <title>delip <parameter>IPADDR</parameter></title>
1162 This command flags IPADDR for deletion from a node at runtime.
1163 It should be followed by a <command>ctdb
1164 ipreallocate</command>. If IPADDR is currently hosted by the
1165 node it is being removed from, this ensures that the IP will
1166 first be failed over to another node, if possible, and that it
1167 is then actually removed.
1170 Note that this only updates the runtime instance of CTDB. Any
1171 changes will be lost next time CTDB is restarted and the
1172 public addresses file is re-read. If you want this change to
1173 be permanent you must also update the public addresses file
1179 <title>moveip <parameter>IPADDR</parameter> <parameter>PNN</parameter></title>
1181 This command can be used to manually fail a public ip address to a
1185 In order to manually override the "automatic" distribution of public
1186 ip addresses that ctdb normally provides, this command only works
1187 when you have changed the tunables for the daemon to:
1190 IPAllocAlgorithm != 0
1198 <title>shutdown</title>
1200 This command will shutdown a specific CTDB daemon.
1205 <title>setlmasterrole on|off</title>
1207 This command is used to 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.
1211 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.
1214 Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
1217 See also "ctdb getcapabilities"
1222 <title>setleaderrole on|off</title>
1224 This command is used to enable/disable the LEADER capability
1225 for a node at runtime. This capability determines whether or
1226 not a node can be elected leader of the cluster. A node that
1227 does not have the LEADER capability can not be elected
1228 leader. If the current leader has this capability removed then
1229 an election will occur.
1233 Nodes have this capability enabled by default, but it can be
1234 removed via the <command>cluster:leader capability</command>
1235 configuration setting or by using this command.
1238 See also "ctdb getcapabilities"
1243 <title>reloadnodes</title>
1245 This command is used when adding new nodes, or removing
1246 existing nodes from an existing cluster.
1249 Procedure to add nodes:
1254 To expand an existing cluster, first ensure with
1255 <command>ctdb status</command> that all nodes are up and
1256 running and that they are all healthy. Do not try to
1257 expand a cluster unless it is completely healthy!
1262 On all nodes, edit <filename>/usr/local/etc/ctdb/nodes</filename>
1263 and <emphasis>add the new nodes at the end of this
1269 Verify that all the nodes have identical
1270 <filename>/usr/local/etc/ctdb/nodes</filename> files after adding
1276 Run <command>ctdb reloadnodes</command> to force all nodes
1277 to reload the nodes file.
1282 Use <command>ctdb status</command> on all nodes and verify
1283 that they now show the additional nodes.
1288 Install and configure the new node and bring it online.
1293 Procedure to remove nodes:
1298 To remove nodes from an existing cluster, first ensure
1299 with <command>ctdb status</command> that all nodes, except
1300 the node to be deleted, are up and running and that they
1301 are all healthy. Do not try to remove nodes from a
1302 cluster unless the cluster is completely healthy!
1307 Shutdown and power off the node to be removed.
1312 On all other nodes, edit the
1313 <filename>/usr/local/etc/ctdb/nodes</filename> file and
1314 <emphasis>comment out</emphasis> the nodes to be removed.
1315 <emphasis>Do not delete the lines for the deleted
1316 nodes</emphasis>, just comment them out by adding a '#' at
1317 the beginning of the lines.
1322 Run <command>ctdb reloadnodes</command> to force all nodes
1323 to reload the nodes file.
1328 Use <command>ctdb status</command> on all nodes and verify
1329 that the deleted nodes are no longer listed.
1339 <optional><parameter>PNN-LIST</parameter></optional>
1342 This command reloads the public addresses configuration file
1343 on the specified nodes. When it completes addresses will be
1344 reconfigured and reassigned across the cluster as necessary.
1348 This command is currently unable to make changes to the
1349 netmask or interfaces associated with existing addresses.
1350 Such changes must be made in 2 steps by deleting addresses in
1351 question and re-adding then. Unfortunately this will disrupt
1352 connections to the changed addresses.
1357 <title>getdbmap</title>
1359 This command lists all clustered TDB databases that the CTDB
1360 daemon has attached to. Some databases are flagged as PERSISTENT,
1361 this means that the database stores data persistently and the
1362 data will remain across reboots. One example of such a database
1363 is secrets.tdb where information about how the cluster was joined
1364 to the domain is stored. Some database are flagged as REPLICATED,
1365 this means that the data in that database is replicated across all
1366 the nodes. But the data will not remain across reboots. This
1367 type of database is used by CTDB to store it's internal state.
1370 If a PERSISTENT database is not in a healthy state the database
1371 is flagged as UNHEALTHY. If there's at least one completely
1372 healthy node running in the cluster, it's possible that the
1373 content is restored by a recovery run automatically. Otherwise an
1374 administrator needs to analyze the problem.
1377 See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1378 "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1379 and (if samba or tdb-utils are installed) "tdbtool check".
1382 Most databases are not persistent and only store the state
1383 information that the currently running samba daemons need. These
1384 databases are always wiped when ctdb/samba starts and when a
1389 <title>Example</title>
1392 Number of databases:10
1393 dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
1394 dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
1395 dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
1396 dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
1397 dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
1398 dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
1399 dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1400 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
1401 dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1402 dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
1404 # ctdb getdbmap # example for unhealthy database
1405 Number of databases:1
1406 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1409 |ID|Name|Path|Persistent|Unhealthy|
1410 |0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
1418 <parameter>DB</parameter>
1419 <parameter>FILE</parameter>
1422 Copy the contents of database DB to FILE. FILE can later be
1423 read back using <command>restoredb</command>. This is mainly
1424 useful for backing up persistent databases such as
1425 <filename>secrets.tdb</filename> and similar.
1432 <parameter>FILE</parameter>
1433 <optional><parameter>DB</parameter></optional>
1436 This command restores a persistent database that was
1437 previously backed up using backupdb. By default the data will
1438 be restored back into the same database as it was created
1439 from. By specifying dbname you can restore the data into a
1445 <title>setdbreadonly <parameter>DB</parameter></title>
1447 This command will enable the read-only record support for a
1448 database. This is an experimental feature to improve
1449 performance for contended records primarily in locking.tdb and
1450 brlock.tdb. When enabling this feature you must set it on all
1451 nodes in the cluster.
1456 <title>setdbsticky <parameter>DB</parameter></title>
1458 This command will enable the sticky record support for the
1459 specified database. This is an experimental feature to
1460 improve performance for contended records primarily in
1461 locking.tdb and brlock.tdb. When enabling this feature you
1462 must set it on all nodes in the cluster.
1469 <title>INTERNAL COMMANDS</title>
1472 Internal commands are used by CTDB's scripts and are not
1473 required for managing a CTDB cluster. Their parameters and
1474 behaviour are subject to change.
1478 <title>gettickles <parameter>IPADDR</parameter></title>
1480 Show TCP connections that are registered with CTDB to be
1481 "tickled" if there is a failover.
1486 <title>gratarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1488 Send out a gratuitous ARP for the specified interface through
1489 the specified interface. This command is mainly used by the
1496 pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1505 pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1508 Print the value associated with KEY in DB.
1515 <parameter>DB</parameter>
1516 <parameter>KEY</parameter>
1517 <parameter>FILE</parameter>
1520 Store KEY in DB with contents of FILE as the associated value.
1527 <parameter>DB</parameter>
1528 <optional><parameter>FILE</parameter></optional>
1531 Read a list of key-value pairs, one per line from FILE, and
1532 store them in DB using a single transaction. An empty value
1533 is equivalent to deleting the given key.
1536 The key and value should be separated by spaces or tabs. Each
1537 key/value should be a printable string enclosed in
1543 <title>runstate [setup|first_recovery|startup|running]</title>
1545 Print the runstate of the specified node. Runstates are used
1546 to serialise important state transitions in CTDB, particularly
1550 If one or more optional runstate arguments are specified then
1551 the node must be in one of these runstates for the command to
1555 <title>Example</title>
1564 <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1566 Set the internal state of network interface IFACE. This is
1567 typically used in the <filename>10.interface</filename> script
1568 in the "monitor" event.
1571 Example: ctdb setifacelink eth0 up
1576 <title>tickle</title>
1578 Read a list of TCP connections, one per line, from standard
1579 input and send a TCP tickle to the source host for each
1580 connection. A connection is specified as:
1583 <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1586 A single connection can be specified on the command-line
1587 rather than on standard input.
1590 A TCP tickle is a TCP ACK packet with an invalid sequence and
1591 acknowledge number and will when received by the source host
1592 result in it sending an immediate correct ACK back to the
1596 TCP tickles are useful to "tickle" clients after a IP failover has
1597 occurred since this will make the client immediately recognize the
1598 TCP connection has been disrupted and that the client will need
1599 to reestablish. This greatly speeds up the time it takes for a client
1600 to detect and reestablish after an IP failover in the ctdb cluster.
1605 <title>version</title>
1607 Display the CTDB version.
1614 <title>DEBUGGING COMMANDS</title>
1616 These commands are primarily used for CTDB development and testing and
1617 should not be used for normal administration.
1622 <title>OPTIONS</title>
1625 <varlistentry><term>--print-emptyrecords</term>
1628 This enables printing of empty records when dumping databases
1629 with the catdb, cattbd and dumpdbbackup commands. Records with
1630 empty data segment are considered deleted by ctdb and cleaned
1631 by the vacuuming mechanism, so this switch can come in handy for
1632 debugging the vacuuming behaviour.
1637 <varlistentry><term>--print-datasize</term>
1640 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1641 size of the record data instead of dumping the data contents.
1646 <varlistentry><term>--print-lmaster</term>
1649 This lets catdb print the lmaster for each record.
1654 <varlistentry><term>--print-hash</term>
1657 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1658 hash for each record.
1663 <varlistentry><term>--print-recordflags</term>
1666 This lets catdb and dumpdbbackup print the
1667 record flags for each record. Note that cattdb always
1677 <title>process-exists <parameter>PID</parameter> <parameter>[SRVID]</parameter></title>
1679 This command checks if a specific process exists on the CTDB
1680 host. This is mainly used by Samba to check if remote instances
1681 of samba are still running or not. When the optional SRVID
1682 argument is specified, the command check if a specific process
1683 exists on the CTDB host and has registered for specified SRVID.
1688 <title>getdbstatus <parameter>DB</parameter></title>
1690 This command displays more details about a database.
1693 <title>Example</title>
1695 # ctdb getdbstatus test.tdb.0
1698 path: /usr/local/var/lib/ctdb/test.tdb.0
1702 # ctdb getdbstatus registry.tdb # with a corrupted TDB
1705 path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
1707 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1713 <title>catdb <parameter>DB</parameter></title>
1715 Print a dump of the clustered TDB database DB.
1720 <title>cattdb <parameter>DB</parameter></title>
1722 Print a dump of the contents of the local TDB database DB.
1727 <title>dumpdbbackup <parameter>FILE</parameter></title>
1729 Print a dump of the contents from database backup FILE,
1730 similar to <command>catdb</command>.
1735 <title>wipedb <parameter>DB</parameter></title>
1737 Remove all contents of database DB.
1742 <title>recover</title>
1744 This command will trigger the recovery daemon to do a cluster
1750 <title>ipreallocate, sync</title>
1752 This command will force the leader to perform a full ip
1753 reallocation process and redistribute all ip addresses. This
1754 is useful to "reset" the allocations back to its default state
1755 if they have been changed using the "moveip" command. While a
1756 "recover" will also perform this reallocation, a recovery is
1757 much more hevyweight since it will also rebuild all the
1763 <title>attach <parameter>DBNAME</parameter> [persistent|replicated]</title>
1765 Create a new CTDB database called DBNAME and attach to it on
1771 <title>detach <parameter>DB-LIST</parameter></title>
1773 Detach specified non-persistent database(s) from the cluster. This
1774 command will disconnect specified database(s) on all nodes in
1775 the cluster. This command should only be used when none of the
1776 specified database(s) are in use.
1779 All nodes should be active and tunable AllowClientDBAccess should
1780 be disabled on all nodes before detaching databases.
1785 <title>dumpmemory</title>
1787 This is a debugging command. This command will make the ctdb
1788 daemon to write a fill memory allocation map to standard output.
1793 <title>rddumpmemory</title>
1795 This is a debugging command. This command will dump the talloc memory
1796 allocation tree for the recovery daemon to standard output.
1801 <title>ban <parameter>BANTIME</parameter></title>
1803 Administratively ban a node for BANTIME seconds. The node
1804 will be unbanned after BANTIME seconds have elapsed.
1807 A banned node does not participate in the cluster. It does
1808 not host any records for the clustered TDB and does not host
1809 any public IP addresses.
1812 Nodes are automatically banned if they misbehave. For
1813 example, a node may be banned if it causes too many cluster
1817 To administratively exclude a node from a cluster use the
1818 <command>stop</command> command.
1823 <title>unban</title>
1825 This command is used to unban a node that has either been
1826 administratively banned using the ban command or has been
1827 automatically banned.
1833 <!-- UNDOCUMENTED: stats
1835 tfetch tstore readkey writekey
1836 checktcpport getdbseqnum
1840 <title>SEE ALSO</title>
1842 <citerefentry><refentrytitle>ctdbd</refentrytitle>
1843 <manvolnum>1</manvolnum></citerefentry>,
1845 <citerefentry><refentrytitle>onnode</refentrytitle>
1846 <manvolnum>1</manvolnum></citerefentry>,
1848 <citerefentry><refentrytitle>ctdb</refentrytitle>
1849 <manvolnum>7</manvolnum></citerefentry>,
1851 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1852 <manvolnum>7</manvolnum></citerefentry>,
1854 <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1855 <manvolnum>7</manvolnum></citerefentry>,
1857 <ulink url="http://ctdb.samba.org/"/>