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</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 Dec 17 19:39:11 2016
657 01.reclock OK 0.013 Sat Dec 17 19:39:11 2016
658 05.system OK 0.029 Sat Dec 17 19:39:11 2016
659 06.nfs OK 0.014 Sat Dec 17 19:39:11 2016
660 10.interface OK 0.037 Sat Dec 17 19:39:11 2016
661 11.natgw OK 0.011 Sat Dec 17 19:39:11 2016
662 11.routing OK 0.007 Sat Dec 17 19:39:11 2016
663 13.per_ip_routing OK 0.007 Sat Dec 17 19:39:11 2016
664 20.multipathd OK 0.007 Sat Dec 17 19:39:11 2016
665 31.clamd OK 0.007 Sat Dec 17 19:39:11 2016
666 40.vsftpd OK 0.013 Sat Dec 17 19:39:11 2016
667 41.httpd OK 0.018 Sat Dec 17 19:39:11 2016
668 49.winbind OK 0.023 Sat Dec 17 19:39:11 2016
669 50.samba OK 0.100 Sat Dec 17 19:39:12 2016
670 60.nfs OK 0.376 Sat Dec 17 19:39:12 2016
671 70.iscsi OK 0.009 Sat Dec 17 19:39:12 2016
672 91.lvs OK 0.007 Sat Dec 17 19:39:12 2016
679 # ctdb event status legacy monitor
680 00.ctdb OK 0.011 Sat Dec 17 19:40:46 2016
681 01.reclock OK 0.010 Sat Dec 17 19:40:46 2016
682 05.system OK 0.030 Sat Dec 17 19:40:46 2016
683 06.nfs OK 0.014 Sat Dec 17 19:40:46 2016
684 10.interface OK 0.041 Sat Dec 17 19:40:46 2016
685 11.natgw OK 0.008 Sat Dec 17 19:40:46 2016
686 11.routing OK 0.007 Sat Dec 17 19:40:46 2016
687 13.per_ip_routing OK 0.007 Sat Dec 17 19:40:46 2016
688 20.multipathd OK 0.007 Sat Dec 17 19:40:46 2016
689 31.clamd OK 0.007 Sat Dec 17 19:40:46 2016
690 40.vsftpd OK 0.013 Sat Dec 17 19:40:46 2016
691 41.httpd OK 0.015 Sat Dec 17 19:40:46 2016
692 49.winbind OK 0.022 Sat Dec 17 19:40:46 2016
693 50.samba ERROR 0.077 Sat Dec 17 19:40:46 2016
694 OUTPUT: ERROR: samba tcp port 445 is not responding
700 <term>script list <parameter>COMPONENT</parameter></term>
703 List the available event scripts in COMPONENT. Enabled
704 scripts are flagged with a '*'.
707 Generally, event scripts are provided by CTDB. However,
708 local or 3rd party event scripts may also be available.
709 These are shown in a separate section after those
716 # ctdb event script list legacy
741 <term>script enable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
744 Enable the specified event SCRIPT in COMPONENT. Only
745 enabled scripts will be executed when running any event.
751 <term>script disable <parameter>COMPONENT</parameter> <parameter>SCRIPT</parameter></term>
754 Disable the specified event SCRIPT in COMPONENT. This
755 will prevent the script from executing when running any
764 <title>scriptstatus</title>
766 This is an alias for <command>ctdb event status legacy
767 <optional>EVENT</optional></command>, where EVENT defaults to
768 <command>monitor</command>.
771 This command is deprecated. It's provided for backward
772 compatibility. Use <command>ctdb event status</command>
778 <title>listvars</title>
780 List all tuneable variables, except the values of the obsolete tunables
781 like VacuumMinInterval. The obsolete tunables can be retrieved only
782 explicitly with the "ctdb getvar" command.
785 <title>Example</title>
788 SeqnumInterval = 1000
791 KeepaliveInterval = 5
798 TickleUpdateInterval = 20
799 EventScriptTimeout = 30
800 MonitorTimeoutCount = 20
801 RecoveryGracePeriod = 120
802 RecoveryBanPeriod = 300
803 DatabaseHashSize = 100001
805 RerecoveryTimeout = 10
808 VerboseMemoryNames = 0
812 RecLockLatencyMs = 1000
813 RecoveryDropAllIPs = 120
815 VacuumMaxRunTime = 120
817 VacuumFastPathCount = 60
818 MaxQueueDropMsg = 1000000
819 AllowUnhealthyDBRead = 0
820 StatHistoryInterval = 1
821 DeferredAttachTO = 120
822 AllowClientDBAttach = 1
823 RecoverPDBBySeqNum = 1
824 DeferredRebalanceOnNodeAdd = 300
826 HopcountMakeSticky = 50
830 DBRecordCountWarn = 100000
831 DBRecordSizeWarn = 10000000
832 DBSizeWarn = 100000000
833 PullDBPreallocation = 10485760
834 LockProcessesPerDB = 200
835 RecBufferSizeLimit = 1000000
836 QueueBufferSize = 1024
843 <title>getvar <parameter>NAME</parameter></title>
845 Get the runtime value of a tuneable variable.
848 <title>Example</title>
850 # ctdb getvar MonitorInterval
857 <title>setvar <parameter>NAME</parameter> <parameter>VALUE</parameter></title>
859 Set the runtime value of a tuneable variable.
862 <title>Example</title>
864 # ctdb setvar MonitorInterval 20
870 <title>lvs {leader|list|status}</title>
872 This command shows different aspects of LVS status. For an
873 overview of CTDB's LVS functionality please see the
874 <citetitle>LVS</citetitle> section in
875 <citerefentry><refentrytitle>ctdb</refentrytitle>
876 <manvolnum>7</manvolnum></citerefentry>.
884 Shows the PNN of the current LVS leader node.
898 Lists the currently usable LVS nodes.
913 List the nodes in the current LVS group and their status.
919 pnn:0 10.0.0.11 UNHEALTHY (THIS NODE)
920 pnn:1 10.0.0.12 UNHEALTHY
932 <title>getcapabilities</title>
935 This command shows the capabilities of the current node. See
936 the <citetitle>CAPABILITIES</citetitle> section in
937 <citerefentry><refentrytitle>ctdb</refentrytitle>
938 <manvolnum>7</manvolnum></citerefentry> for more details.
952 <title>statistics</title>
954 Collect statistics from the CTDB daemon about
955 how many calls it has served. Information about
956 various fields in statistics can be found in
957 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
958 <manvolnum>7</manvolnum></citerefentry>.
961 <title>Example</title>
965 Current time of statistics : Tue Mar 8 15:18:51 2016
966 Statistics collected since : (003 21:31:32) Fri Mar 4 17:47:19 2016
971 client_packets_sent 8170534
972 client_packets_recv 7166132
973 node_packets_sent 16549998
974 node_packets_recv 5244418
975 keepalive_packets_sent 201969
976 keepalive_packets_recv 201969
985 reply_control 6831284
1002 pending_childwrite_calls 0
1005 total_ro_delegations 0
1007 hop_count_buckets: 8 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1008 lock_buckets: 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0
1009 locks_latency MIN/AVG/MAX 0.010005/0.010418/0.011010 sec out of 8
1010 reclock_ctdbd MIN/AVG/MAX 0.002538/0.002538/0.002538 sec out of 1
1011 reclock_recd MIN/AVG/MAX 0.000000/0.000000/0.000000 sec out of 0
1012 call_latency MIN/AVG/MAX 0.000044/0.002142/0.011702 sec out of 15
1013 childwrite_latency MIN/AVG/MAX 0.000000/0.000000/0.000000 sec out of 0
1019 <title>statisticsreset</title>
1021 This command is used to clear all statistics counters in a node.
1024 Example: ctdb statisticsreset
1029 <title>dbstatistics <parameter>DB</parameter></title>
1031 Display statistics about the database DB. Information
1032 about various fields in dbstatistics can be found in
1033 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1034 <manvolnum>7</manvolnum></citerefentry>.
1037 <title>Example</title>
1039 # ctdb dbstatistics locking.tdb
1040 DB Statistics: locking.tdb
1048 hop_count_buckets: 28087 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1049 lock_buckets: 0 14188 38 76 32 19 3 0 0 0 0 0 0 0 0 0
1050 locks_latency MIN/AVG/MAX 0.001066/0.012686/4.202292 sec out of 14356
1051 vacuum_latency MIN/AVG/MAX 0.000472/0.002207/15.243570 sec out of 224530
1053 Count:8 Key:ff5bd7cb3ee3822edc1f0000000000000000000000000000
1059 <title>getreclock</title>
1061 Show details of the recovery lock, if any.
1068 /clusterfs/.ctdb/recovery.lock
1074 <title>getdebug</title>
1076 Get the current debug level for the node. the debug level controls what information is written to the log file.
1079 The debug levels are mapped to the corresponding syslog levels.
1080 When a debug level is set, only those messages at that level and higher
1081 levels will be printed.
1084 The list of debug levels from highest to lowest are :
1087 ERROR WARNING NOTICE INFO DEBUG
1092 <title>setdebug <parameter>DEBUGLEVEL</parameter></title>
1094 Set the debug level of a node. This controls what information will be logged.
1097 The debuglevel is one of ERROR WARNING NOTICE INFO DEBUG
1102 <title>getpid</title>
1104 This command will return the process id of the ctdb daemon.
1109 <title>disable</title>
1111 This command is used to administratively disable a node in the cluster.
1112 A disabled node will still participate in the cluster and host
1113 clustered TDB records but its public ip address has been taken over by
1114 a different node and it no longer hosts any services.
1119 <title>enable</title>
1121 Re-enable a node that has been administratively disabled.
1128 This command is used to administratively STOP a node in the cluster.
1129 A STOPPED node is connected to the cluster but will not host any
1130 public ip addresses, nor does it participate in the VNNMAP.
1131 The difference between a DISABLED node and a STOPPED node is that
1132 a STOPPED node does not host any parts of the database which means
1133 that a recovery is required to stop/continue nodes.
1138 <title>continue</title>
1140 Re-start a node that has been administratively stopped.
1145 <title>addip <parameter>IPADDR</parameter>/<parameter>mask</parameter> <parameter>IFACE</parameter></title>
1147 This command is used to add a new public ip to a node
1148 during runtime. It should be followed by a <command>ctdb
1149 ipreallocate</command>. This allows public addresses to be
1150 added to a cluster without having to restart the ctdb daemons.
1153 Note that this only updates the runtime instance of ctdb. Any
1154 changes will be lost next time ctdb is restarted and the public
1155 addresses file is re-read. If you want this change to be
1156 permanent you must also update the public addresses file manually.
1161 <title>delip <parameter>IPADDR</parameter></title>
1163 This command flags IPADDR for deletion from a node at runtime.
1164 It should be followed by a <command>ctdb
1165 ipreallocate</command>. If IPADDR is currently hosted by the
1166 node it is being removed from, this ensures that the IP will
1167 first be failed over to another node, if possible, and that it
1168 is then actually removed.
1171 Note that this only updates the runtime instance of CTDB. Any
1172 changes will be lost next time CTDB is restarted and the
1173 public addresses file is re-read. If you want this change to
1174 be permanent you must also update the public addresses file
1180 <title>moveip <parameter>IPADDR</parameter> <parameter>PNN</parameter></title>
1182 This command can be used to manually fail a public ip address to a
1186 In order to manually override the "automatic" distribution of public
1187 ip addresses that ctdb normally provides, this command only works
1188 when you have changed the tunables for the daemon to:
1191 IPAllocAlgorithm != 0
1199 <title>shutdown</title>
1201 This command will shutdown a specific CTDB daemon.
1206 <title>setlmasterrole on|off</title>
1208 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.
1212 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.
1215 Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect.
1218 See also "ctdb getcapabilities"
1223 <title>setleaderrole on|off</title>
1225 This command is used to enable/disable the LEADER capability
1226 for a node at runtime. This capability determines whether or
1227 not a node can be elected leader of the cluster. A node that
1228 does not have the LEADER capability can not be elected
1229 leader. If the current leader has this capability removed then
1230 an election will occur.
1234 Nodes have this capability enabled by default, but it can be
1235 removed via the <command>cluster:leader capability</command>
1236 configuration setting or by using this command.
1239 See also "ctdb getcapabilities"
1244 <title>reloadnodes</title>
1246 This command is used when adding new nodes, or removing
1247 existing nodes from an existing cluster.
1250 Procedure to add nodes:
1255 To expand an existing cluster, first ensure with
1256 <command>ctdb status</command> that all nodes are up and
1257 running and that they are all healthy. Do not try to
1258 expand a cluster unless it is completely healthy!
1263 On all nodes, edit <filename>/usr/local/etc/ctdb/nodes</filename>
1264 and <emphasis>add the new nodes at the end of this
1270 Verify that all the nodes have identical
1271 <filename>/usr/local/etc/ctdb/nodes</filename> files after adding
1277 Run <command>ctdb reloadnodes</command> to force all nodes
1278 to reload the nodes file.
1283 Use <command>ctdb status</command> on all nodes and verify
1284 that they now show the additional nodes.
1289 Install and configure the new node and bring it online.
1294 Procedure to remove nodes:
1299 To remove nodes from an existing cluster, first ensure
1300 with <command>ctdb status</command> that all nodes, except
1301 the node to be deleted, are up and running and that they
1302 are all healthy. Do not try to remove nodes from a
1303 cluster unless the cluster is completely healthy!
1308 Shutdown and power off the node to be removed.
1313 On all other nodes, edit the
1314 <filename>/usr/local/etc/ctdb/nodes</filename> file and
1315 <emphasis>comment out</emphasis> the nodes to be removed.
1316 <emphasis>Do not delete the lines for the deleted
1317 nodes</emphasis>, just comment them out by adding a '#' at
1318 the beginning of the lines.
1323 Run <command>ctdb reloadnodes</command> to force all nodes
1324 to reload the nodes file.
1329 Use <command>ctdb status</command> on all nodes and verify
1330 that the deleted nodes are no longer listed.
1340 <optional><parameter>PNN-LIST</parameter></optional>
1343 This command reloads the public addresses configuration file
1344 on the specified nodes. When it completes addresses will be
1345 reconfigured and reassigned across the cluster as necessary.
1349 This command is currently unable to make changes to the
1350 netmask or interfaces associated with existing addresses.
1351 Such changes must be made in 2 steps by deleting addresses in
1352 question and re-adding then. Unfortunately this will disrupt
1353 connections to the changed addresses.
1358 <title>getdbmap</title>
1360 This command lists all clustered TDB databases that the CTDB
1361 daemon has attached to. Some databases are flagged as PERSISTENT,
1362 this means that the database stores data persistently and the
1363 data will remain across reboots. One example of such a database
1364 is secrets.tdb where information about how the cluster was joined
1365 to the domain is stored. Some database are flagged as REPLICATED,
1366 this means that the data in that database is replicated across all
1367 the nodes. But the data will not remain across reboots. This
1368 type of database is used by CTDB to store it's internal state.
1371 If a PERSISTENT database is not in a healthy state the database
1372 is flagged as UNHEALTHY. If there's at least one completely
1373 healthy node running in the cluster, it's possible that the
1374 content is restored by a recovery run automatically. Otherwise an
1375 administrator needs to analyze the problem.
1378 See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb",
1379 "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1"
1380 and (if samba or tdb-utils are installed) "tdbtool check".
1383 Most databases are not persistent and only store the state
1384 information that the currently running samba daemons need. These
1385 databases are always wiped when ctdb/samba starts and when a
1390 <title>Example</title>
1393 Number of databases:10
1394 dbid:0x435d3410 name:notify.tdb path:/usr/local/var/lib/ctdb/notify.tdb.0
1395 dbid:0x42fe72c5 name:locking.tdb path:/usr/local/var/lib/ctdb/locking.tdb.0
1396 dbid:0x1421fb78 name:brlock.tdb path:/usr/local/var/lib/ctdb/brlock.tdb.0
1397 dbid:0x17055d90 name:connections.tdb path:/usr/local/var/lib/ctdb/connections.tdb.0
1398 dbid:0xc0bdde6a name:sessionid.tdb path:/usr/local/var/lib/ctdb/sessionid.tdb.0
1399 dbid:0x122224da name:test.tdb path:/usr/local/var/lib/ctdb/test.tdb.0
1400 dbid:0x2672a57f name:idmap2.tdb path:/usr/local/var/lib/ctdb/persistent/idmap2.tdb.0 PERSISTENT
1401 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT
1402 dbid:0xe98e08b6 name:group_mapping.tdb path:/usr/local/var/lib/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
1403 dbid:0x7bbbd26c name:passdb.tdb path:/usr/local/var/lib/ctdb/persistent/passdb.tdb.0 PERSISTENT
1405 # ctdb getdbmap # example for unhealthy database
1406 Number of databases:1
1407 dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets.tdb.0 PERSISTENT UNHEALTHY
1410 |ID|Name|Path|Persistent|Unhealthy|
1411 |0x7bbbd26c|passdb.tdb|/usr/local/var/lib/ctdb/persistent/passdb.tdb.0|1|0|
1419 <parameter>DB</parameter>
1420 <parameter>FILE</parameter>
1423 Copy the contents of database DB to FILE. FILE can later be
1424 read back using <command>restoredb</command>. This is mainly
1425 useful for backing up persistent databases such as
1426 <filename>secrets.tdb</filename> and similar.
1433 <parameter>FILE</parameter>
1434 <optional><parameter>DB</parameter></optional>
1437 This command restores a persistent database that was
1438 previously backed up using backupdb. By default the data will
1439 be restored back into the same database as it was created
1440 from. By specifying dbname you can restore the data into a
1446 <title>setdbreadonly <parameter>DB</parameter></title>
1448 This command will enable the read-only record support for a
1449 database. This is an experimental feature to improve
1450 performance for contended records primarily in locking.tdb and
1451 brlock.tdb. When enabling this feature you must set it on all
1452 nodes in the cluster.
1457 <title>setdbsticky <parameter>DB</parameter></title>
1459 This command will enable the sticky record support for the
1460 specified database. This is an experimental feature to
1461 improve performance for contended records primarily in
1462 locking.tdb and brlock.tdb. When enabling this feature you
1463 must set it on all nodes in the cluster.
1470 <title>INTERNAL COMMANDS</title>
1473 Internal commands are used by CTDB's scripts and are not
1474 required for managing a CTDB cluster. Their parameters and
1475 behaviour are subject to change.
1479 <title>gettickles <parameter>IPADDR</parameter></title>
1481 Show TCP connections that are registered with CTDB to be
1482 "tickled" if there is a failover.
1487 <title>gratarp <parameter>IPADDR</parameter> <parameter>INTERFACE</parameter></title>
1489 Send out a gratuitous ARP for the specified interface through
1490 the specified interface. This command is mainly used by the
1497 pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
1506 pfetch <parameter>DB</parameter> <parameter>KEY</parameter>
1509 Print the value associated with KEY in DB.
1516 <parameter>DB</parameter>
1517 <parameter>KEY</parameter>
1518 <parameter>FILE</parameter>
1521 Store KEY in DB with contents of FILE as the associated value.
1528 <parameter>DB</parameter>
1529 <optional><parameter>FILE</parameter></optional>
1532 Read a list of key-value pairs, one per line from FILE, and
1533 store them in DB using a single transaction. An empty value
1534 is equivalent to deleting the given key.
1537 The key and value should be separated by spaces or tabs. Each
1538 key/value should be a printable string enclosed in
1544 <title>runstate [setup|first_recovery|startup|running]</title>
1546 Print the runstate of the specified node. Runstates are used
1547 to serialise important state transitions in CTDB, particularly
1551 If one or more optional runstate arguments are specified then
1552 the node must be in one of these runstates for the command to
1556 <title>Example</title>
1565 <title>setifacelink <parameter>IFACE</parameter> up|down</title>
1567 Set the internal state of network interface IFACE. This is
1568 typically used in the <filename>10.interface</filename> script
1569 in the "monitor" event.
1572 Example: ctdb setifacelink eth0 up
1577 <title>tickle</title>
1579 Read a list of TCP connections, one per line, from standard
1580 input and send a TCP tickle to the source host for each
1581 connection. A connection is specified as:
1584 <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
1587 A single connection can be specified on the command-line
1588 rather than on standard input.
1591 A TCP tickle is a TCP ACK packet with an invalid sequence and
1592 acknowledge number and will when received by the source host
1593 result in it sending an immediate correct ACK back to the
1597 TCP tickles are useful to "tickle" clients after a IP failover has
1598 occurred since this will make the client immediately recognize the
1599 TCP connection has been disrupted and that the client will need
1600 to reestablish. This greatly speeds up the time it takes for a client
1601 to detect and reestablish after an IP failover in the ctdb cluster.
1606 <title>version</title>
1608 Display the CTDB version.
1615 <title>DEBUGGING COMMANDS</title>
1617 These commands are primarily used for CTDB development and testing and
1618 should not be used for normal administration.
1623 <title>OPTIONS</title>
1626 <varlistentry><term>--print-emptyrecords</term>
1629 This enables printing of empty records when dumping databases
1630 with the catdb, cattbd and dumpdbbackup commands. Records with
1631 empty data segment are considered deleted by ctdb and cleaned
1632 by the vacuuming mechanism, so this switch can come in handy for
1633 debugging the vacuuming behaviour.
1638 <varlistentry><term>--print-datasize</term>
1641 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1642 size of the record data instead of dumping the data contents.
1647 <varlistentry><term>--print-lmaster</term>
1650 This lets catdb print the lmaster for each record.
1655 <varlistentry><term>--print-hash</term>
1658 This lets database dumps (catdb, cattdb, dumpdbbackup) print the
1659 hash for each record.
1664 <varlistentry><term>--print-recordflags</term>
1667 This lets catdb and dumpdbbackup print the
1668 record flags for each record. Note that cattdb always
1678 <title>process-exists <parameter>PID</parameter> <parameter>[SRVID]</parameter></title>
1680 This command checks if a specific process exists on the CTDB
1681 host. This is mainly used by Samba to check if remote instances
1682 of samba are still running or not. When the optional SRVID
1683 argument is specified, the command check if a specific process
1684 exists on the CTDB host and has registered for specified SRVID.
1689 <title>getdbstatus <parameter>DB</parameter></title>
1691 This command displays more details about a database.
1694 <title>Example</title>
1696 # ctdb getdbstatus test.tdb.0
1699 path: /usr/local/var/lib/ctdb/test.tdb.0
1703 # ctdb getdbstatus registry.tdb # with a corrupted TDB
1706 path: /usr/local/var/lib/ctdb/persistent/registry.tdb.0
1708 HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/lib/ctdb/persistent/registry.tdb.0.corrupted.20091208091949.0Z'
1714 <title>catdb <parameter>DB</parameter></title>
1716 Print a dump of the clustered TDB database DB.
1721 <title>cattdb <parameter>DB</parameter></title>
1723 Print a dump of the contents of the local TDB database DB.
1728 <title>dumpdbbackup <parameter>FILE</parameter></title>
1730 Print a dump of the contents from database backup FILE,
1731 similar to <command>catdb</command>.
1736 <title>wipedb <parameter>DB</parameter></title>
1738 Remove all contents of database DB.
1743 <title>recover</title>
1745 This command will trigger the recovery daemon to do a cluster
1751 <title>ipreallocate, sync</title>
1753 This command will force the leader to perform a full ip
1754 reallocation process and redistribute all ip addresses. This
1755 is useful to "reset" the allocations back to its default state
1756 if they have been changed using the "moveip" command. While a
1757 "recover" will also perform this reallocation, a recovery is
1758 much more hevyweight since it will also rebuild all the
1764 <title>attach <parameter>DBNAME</parameter> [persistent|replicated]</title>
1766 Create a new CTDB database called DBNAME and attach to it on
1772 <title>detach <parameter>DB-LIST</parameter></title>
1774 Detach specified non-persistent database(s) from the cluster. This
1775 command will disconnect specified database(s) on all nodes in
1776 the cluster. This command should only be used when none of the
1777 specified database(s) are in use.
1780 All nodes should be active and tunable AllowClientDBAccess should
1781 be disabled on all nodes before detaching databases.
1786 <title>dumpmemory</title>
1788 This is a debugging command. This command will make the ctdb
1789 daemon to write a fill memory allocation map to standard output.
1794 <title>rddumpmemory</title>
1796 This is a debugging command. This command will dump the talloc memory
1797 allocation tree for the recovery daemon to standard output.
1802 <title>ban <parameter>BANTIME</parameter></title>
1804 Administratively ban a node for BANTIME seconds. The node
1805 will be unbanned after BANTIME seconds have elapsed.
1808 A banned node does not participate in the cluster. It does
1809 not host any records for the clustered TDB and does not host
1810 any public IP addresses.
1813 Nodes are automatically banned if they misbehave. For
1814 example, a node may be banned if it causes too many cluster
1818 To administratively exclude a node from a cluster use the
1819 <command>stop</command> command.
1824 <title>unban</title>
1826 This command is used to unban a node that has either been
1827 administratively banned using the ban command or has been
1828 automatically banned.
1834 <!-- UNDOCUMENTED: stats
1836 tfetch tstore readkey writekey
1837 checktcpport getdbseqnum
1841 <title>SEE ALSO</title>
1843 <citerefentry><refentrytitle>ctdbd</refentrytitle>
1844 <manvolnum>1</manvolnum></citerefentry>,
1846 <citerefentry><refentrytitle>onnode</refentrytitle>
1847 <manvolnum>1</manvolnum></citerefentry>,
1849 <citerefentry><refentrytitle>ctdb</refentrytitle>
1850 <manvolnum>7</manvolnum></citerefentry>,
1852 <citerefentry><refentrytitle>ctdb-statistics</refentrytitle>
1853 <manvolnum>7</manvolnum></citerefentry>,
1855 <citerefentry><refentrytitle>ctdb-tunables</refentrytitle>
1856 <manvolnum>7</manvolnum></citerefentry>,
1858 <ulink url="http://ctdb.samba.org/"/>