b366102a1d4ac2f9efaca357720231c2201f275f
[sahlberg/ctdb.git] / doc / ctdb.1
1 '\" t
2 .\"     Title: ctdb
3 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
5 .\"      Date: 10/12/2011
6 .\"    Manual: CTDB - clustered TDB database
7 .\"    Source: ctdb
8 .\"  Language: English
9 .\"
10 .TH "CTDB" "1" "10/12/2011" "ctdb" "CTDB \- clustered TDB database"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 ctdb \- clustered tdb database management utility
32 .SH "SYNOPSIS"
33 .HP \w'\fBctdb\ [\ OPTIONS\ ]\ COMMAND\ \&.\&.\&.\fR\ 'u
34 \fBctdb [ OPTIONS ] COMMAND \&.\&.\&.\fR
35 .HP \w'\fBctdb\fR\ 'u
36 \fBctdb\fR [\-n\ <node>] [\-Y] [\-t\ <timeout>] [\-T\ <timelimit>] [\-?\ \-\-help] [\-\-usage] [\-d\ \-\-debug=<INTEGER>] [\-\-socket=<filename>]
37 .SH "DESCRIPTION"
38 .PP
39 ctdb is a utility to view and manage a ctdb cluster\&.
40 .SH "OPTIONS"
41 .PP
42 \-n <pnn>
43 .RS 4
44 This specifies the physical node number on which to execute the command\&. Default is to run the command on the daemon running on the local host\&.
45 .sp
46 The physical node number is an integer that describes the node in the cluster\&. The first node has physical node number 0\&.
47 .RE
48 .PP
49 \-Y
50 .RS 4
51 Produce output in machine readable form for easier parsing by scripts\&. Not all commands support this option\&.
52 .RE
53 .PP
54 \-t <timeout>
55 .RS 4
56 How long should ctdb wait for the local ctdb daemon to respond to a command before timing out\&. Default is 3 seconds\&.
57 .RE
58 .PP
59 \-T <timelimit>
60 .RS 4
61 A limit on how long the ctdb command will run for before it will be aborted\&. When this timelimit has been exceeded the ctdb command will terminate\&.
62 .RE
63 .PP
64 \-? \-\-help
65 .RS 4
66 Print some help text to the screen\&.
67 .RE
68 .PP
69 \-\-usage
70 .RS 4
71 Print useage information to the screen\&.
72 .RE
73 .PP
74 \-d \-\-debug=<debuglevel>
75 .RS 4
76 Change the debug level for the command\&. Default is 0\&.
77 .RE
78 .PP
79 \-\-socket=<filename>
80 .RS 4
81 Specify the socketname to use when connecting to the local ctdb daemon\&. The default is /tmp/ctdb\&.socket \&.
82 .sp
83 You only need to specify this parameter if you run multiple ctdb daemons on the same physical host and thus can not use the default name for the domain socket\&.
84 .RE
85 .SH "ADMINISTRATIVE COMMANDS"
86 .PP
87 These are commands used to monitor and administrate a CTDB cluster\&.
88 .SS "pnn"
89 .PP
90 This command displays the pnn of the current node\&.
91 .SS "status"
92 .PP
93 This command shows the current status of the ctdb node\&.
94 .sp
95 .it 1 an-trap
96 .nr an-no-space-flag 1
97 .nr an-break-flag 1
98 .br
99 .ps +1
100 \fBnode status\fR
101 .RS 4
102 .PP
103 Node status reflects the current status of the node\&. There are five possible states:
104 .PP
105 OK \- This node is fully functional\&.
106 .PP
107 DISCONNECTED \- This node could not be connected through the network and is currently not participating in the cluster\&. If there is a public IP address associated with this node it should have been taken over by a different node\&. No services are running on this node\&.
108 .PP
109 DISABLED \- This node has been administratively disabled\&. This node is still functional and participates in the CTDB cluster but its IP addresses have been taken over by a different node and no services are currently being hosted\&.
110 .PP
111 UNHEALTHY \- A service provided by this node is malfunctioning and should be investigated\&. The CTDB daemon itself is operational and participates in the cluster\&. Its public IP address has been taken over by a different node and no services are currnetly being hosted\&. All unhealthy nodes should be investigated and require an administrative action to rectify\&.
112 .PP
113 BANNED \- This node failed too many recovery attempts and has been banned from participating in the cluster for a period of RecoveryBanPeriod seconds\&. Any public IP address has been taken over by other nodes\&. This node does not provide any services\&. All banned nodes should be investigated and require an administrative action to rectify\&. This node does not perticipate in the CTDB cluster but can still be communicated with\&. I\&.e\&. ctdb commands can be sent to it\&.
114 .PP
115 STOPPED \- A node that is stopped does not host any public ip addresses, nor is it part of the VNNMAP\&. A stopped node can not become LVSMASTER, RECMASTER or NATGW\&. This node does not perticipate in the CTDB cluster but can still be communicated with\&. I\&.e\&. ctdb commands can be sent to it\&.
116 .PP
117 PARTIALLYONLINE \- A node that is partially online participates in a cluster like a node that is ok\&. Some interfaces to serve public ip addresses are down, but at least one interface is up\&. See also "ctdb ifaces"\&.
118 .RE
119 .sp
120 .it 1 an-trap
121 .nr an-no-space-flag 1
122 .nr an-break-flag 1
123 .br
124 .ps +1
125 \fBgeneration\fR
126 .RS 4
127 .PP
128 The generation id is a number that indicates the current generation of a cluster instance\&. Each time a cluster goes through a reconfiguration or a recovery its generation id will be changed\&.
129 .PP
130 This number does not have any particular meaning other than to keep track of when a cluster has gone through a recovery\&. It is a random number that represents the current instance of a ctdb cluster and its databases\&. CTDBD uses this number internally to be able to tell when commands to operate on the cluster and the databases was issued in a different generation of the cluster, to ensure that commands that operate on the databases will not survive across a cluster database recovery\&. After a recovery, all old outstanding commands will automatically become invalid\&.
131 .PP
132 Sometimes this number will be shown as "INVALID"\&. This only means that the ctdbd daemon has started but it has not yet merged with the cluster through a recovery\&. All nodes start with generation "INVALID" and are not assigned a real generation id until they have successfully been merged with a cluster through a recovery\&.
133 .RE
134 .sp
135 .it 1 an-trap
136 .nr an-no-space-flag 1
137 .nr an-break-flag 1
138 .br
139 .ps +1
140 \fBVNNMAP\fR
141 .RS 4
142 .PP
143 The list of Virtual Node Numbers\&. This is a list of all nodes that actively participates in the cluster and that share the workload of hosting the Clustered TDB database records\&. Only nodes that are participating in the vnnmap can become lmaster or dmaster for a database record\&.
144 .RE
145 .sp
146 .it 1 an-trap
147 .nr an-no-space-flag 1
148 .nr an-break-flag 1
149 .br
150 .ps +1
151 \fBRecovery mode\fR
152 .RS 4
153 .PP
154 This is the current recovery mode of the cluster\&. There are two possible modes:
155 .PP
156 NORMAL \- The cluster is fully operational\&.
157 .PP
158 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\&.
159 .PP
160 Once the recovery master detects an inconsistency, for example a node becomes disconnected/connected, the recovery daemon will trigger a cluster recovery process, where all databases are remerged across the cluster\&. When this process starts, the recovery master will first "freeze" all databases to prevent applications such as samba from accessing the databases and it will also mark the recovery mode as RECOVERY\&.
161 .PP
162 When CTDBD starts up, it will start in RECOVERY mode\&. Once the node has been merged into a cluster and all databases have been recovered, the node mode will change into NORMAL mode and the databases will be "thawed", allowing samba to access the databases again\&.
163 .RE
164 .sp
165 .it 1 an-trap
166 .nr an-no-space-flag 1
167 .nr an-break-flag 1
168 .br
169 .ps +1
170 \fBRecovery master\fR
171 .RS 4
172 .PP
173 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\&.
174 .PP
175 Only one node at a time can be the designated recovery master\&. Which node is designated the recovery master is decided by an election process in the recovery daemons running on each node\&.
176 .RE
177 .PP
178 Example: ctdb status
179 .PP
180 Example output:
181 .sp
182 .if n \{\
183 .RS 4
184 .\}
185 .nf
186 Number of nodes:4
187 pnn:0 11\&.1\&.2\&.200       OK (THIS NODE)
188 pnn:1 11\&.1\&.2\&.201       OK
189 pnn:2 11\&.1\&.2\&.202       OK
190 pnn:3 11\&.1\&.2\&.203       OK
191 Generation:1362079228
192 Size:4
193 hash:0 lmaster:0
194 hash:1 lmaster:1
195 hash:2 lmaster:2
196 hash:3 lmaster:3
197 Recovery mode:NORMAL (0)
198 Recovery master:0
199       
200 .fi
201 .if n \{\
202 .RE
203 .\}
204 .SS "recmaster"
205 .PP
206 This command shows the pnn of the node which is currently the recmaster\&.
207 .SS "uptime"
208 .PP
209 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\&.
210 .PP
211 Example: ctdb uptime
212 .PP
213 Example output:
214 .sp
215 .if n \{\
216 .RS 4
217 .\}
218 .nf
219 Current time of node          :                Thu Oct 29 10:38:54 2009
220 Ctdbd start time              : (000 16:54:28) Wed Oct 28 17:44:26 2009
221 Time of last recovery/failover: (000 16:53:31) Wed Oct 28 17:45:23 2009
222 Duration of last recovery/failover: 2\&.248552 seconds
223       
224 .fi
225 .if n \{\
226 .RE
227 .\}
228 .SS "listnodes"
229 .PP
230 This command shows lists the ip addresses of all the nodes in the cluster\&.
231 .PP
232 Example: ctdb listnodes
233 .PP
234 Example output:
235 .sp
236 .if n \{\
237 .RS 4
238 .\}
239 .nf
240 10\&.0\&.0\&.71
241 10\&.0\&.0\&.72
242 10\&.0\&.0\&.73
243 10\&.0\&.0\&.74
244       
245 .fi
246 .if n \{\
247 .RE
248 .\}
249 .SS "ping"
250 .PP
251 This command will "ping" all CTDB daemons in the cluster to verify that they are processing commands correctly\&.
252 .PP
253 Example: ctdb ping
254 .PP
255 Example output:
256 .sp
257 .if n \{\
258 .RS 4
259 .\}
260 .nf
261 response from 0 time=0\&.000054 sec  (3 clients)
262 response from 1 time=0\&.000144 sec  (2 clients)
263 response from 2 time=0\&.000105 sec  (2 clients)
264 response from 3 time=0\&.000114 sec  (2 clients)
265       
266 .fi
267 .if n \{\
268 .RE
269 .\}
270 .SS "ifaces"
271 .PP
272 This command will display the list of network interfaces, which could host public addresses, along with their status\&.
273 .PP
274 Example: ctdb ifaces
275 .PP
276 Example output:
277 .sp
278 .if n \{\
279 .RS 4
280 .\}
281 .nf
282 Interfaces on node 0
283 name:eth5 link:up references:2
284 name:eth4 link:down references:0
285 name:eth3 link:up references:1
286 name:eth2 link:up references:1
287       
288 .fi
289 .if n \{\
290 .RE
291 .\}
292 .PP
293 Example: ctdb ifaces \-Y
294 .PP
295 Example output:
296 .sp
297 .if n \{\
298 .RS 4
299 .\}
300 .nf
301 :Name:LinkStatus:References:
302 :eth5:1:2
303 :eth4:0:0
304 :eth3:1:1
305 :eth2:1:1
306       
307 .fi
308 .if n \{\
309 .RE
310 .\}
311 .SS "setifacelink <iface> <status>"
312 .PP
313 This command will set the status of a network interface\&. The status needs to be "up" or "down"\&. This is typically used in the 10\&.interfaces script in the "monitor" event\&.
314 .PP
315 Example: ctdb setifacelink eth0 up
316 .SS "ip"
317 .PP
318 This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip\&. By default this command will ONLY show those public addresses that are known to the node itself\&. To see the full list of all public ips across the cluster you must use "ctdb ip \-n all"\&.
319 .PP
320 Example: ctdb ip
321 .PP
322 Example output:
323 .sp
324 .if n \{\
325 .RS 4
326 .\}
327 .nf
328 Public IPs on node 0
329 172\&.31\&.91\&.82 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
330 172\&.31\&.91\&.83 node[0] active[eth3] available[eth2,eth3] configured[eth2,eth3]
331 172\&.31\&.91\&.84 node[1] active[] available[eth2,eth3] configured[eth2,eth3]
332 172\&.31\&.91\&.85 node[0] active[eth2] available[eth2,eth3] configured[eth2,eth3]
333 172\&.31\&.92\&.82 node[1] active[] available[eth5] configured[eth4,eth5]
334 172\&.31\&.92\&.83 node[0] active[eth5] available[eth5] configured[eth4,eth5]
335 172\&.31\&.92\&.84 node[1] active[] available[eth5] configured[eth4,eth5]
336 172\&.31\&.92\&.85 node[0] active[eth5] available[eth5] configured[eth4,eth5]
337       
338 .fi
339 .if n \{\
340 .RE
341 .\}
342 .PP
343 Example: ctdb ip \-Y
344 .PP
345 Example output:
346 .sp
347 .if n \{\
348 .RS 4
349 .\}
350 .nf
351 :Public IP:Node:ActiveInterface:AvailableInterfaces:ConfiguredInterfaces:
352 :172\&.31\&.91\&.82:1::eth2,eth3:eth2,eth3:
353 :172\&.31\&.91\&.83:0:eth3:eth2,eth3:eth2,eth3:
354 :172\&.31\&.91\&.84:1::eth2,eth3:eth2,eth3:
355 :172\&.31\&.91\&.85:0:eth2:eth2,eth3:eth2,eth3:
356 :172\&.31\&.92\&.82:1::eth5:eth4,eth5:
357 :172\&.31\&.92\&.83:0:eth5:eth5:eth4,eth5:
358 :172\&.31\&.92\&.84:1::eth5:eth4,eth5:
359 :172\&.31\&.92\&.85:0:eth5:eth5:eth4,eth5:
360       
361 .fi
362 .if n \{\
363 .RE
364 .\}
365 .SS "ipinfo <ip>"
366 .PP
367 This command will display details about the specified public addresses\&.
368 .PP
369 Example: ctdb ipinfo 172\&.31\&.92\&.85
370 .PP
371 Example output:
372 .sp
373 .if n \{\
374 .RS 4
375 .\}
376 .nf
377 Public IP[172\&.31\&.92\&.85] info on node 0
378 IP:172\&.31\&.92\&.85
379 CurrentNode:0
380 NumInterfaces:2
381 Interface[1]: Name:eth4 Link:down References:0
382 Interface[2]: Name:eth5 Link:up References:2 (active)
383       
384 .fi
385 .if n \{\
386 .RE
387 .\}
388 .SS "scriptstatus"
389 .PP
390 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\&.
391 .PP
392 Example: ctdb scriptstatus
393 .PP
394 Example output:
395 .sp
396 .if n \{\
397 .RS 4
398 .\}
399 .nf
400 7 scripts were executed last monitoring cycle
401 00\&.ctdb              Status:OK    Duration:0\&.056 Tue Mar 24 18:56:57 2009
402 10\&.interface         Status:OK    Duration:0\&.077 Tue Mar 24 18:56:57 2009
403 11\&.natgw             Status:OK    Duration:0\&.039 Tue Mar 24 18:56:57 2009
404 20\&.multipathd        Status:OK    Duration:0\&.038 Tue Mar 24 18:56:57 2009
405 31\&.clamd             Status:DISABLED
406 40\&.vsftpd            Status:OK    Duration:0\&.045 Tue Mar 24 18:56:57 2009
407 41\&.httpd             Status:OK    Duration:0\&.039 Tue Mar 24 18:56:57 2009
408 50\&.samba             Status:ERROR    Duration:0\&.082 Tue Mar 24 18:56:57 2009
409    OUTPUT:ERROR: Samba tcp port 445 is not responding
410       
411 .fi
412 .if n \{\
413 .RE
414 .\}
415 .SS "disablescript <script>"
416 .PP
417 This command is used to disable an eventscript\&.
418 .PP
419 This will take effect the next time the eventscripts are being executed so it can take a short while until this is reflected in \*(Aqscriptstatus\*(Aq\&.
420 .SS "enablescript <script>"
421 .PP
422 This command is used to enable an eventscript\&.
423 .PP
424 This will take effect the next time the eventscripts are being executed so it can take a short while until this is reflected in \*(Aqscriptstatus\*(Aq\&.
425 .SS "getvar <name>"
426 .PP
427 Get the runtime value of a tuneable variable\&.
428 .PP
429 Example: ctdb getvar MaxRedirectCount
430 .PP
431 Example output:
432 .sp
433 .if n \{\
434 .RS 4
435 .\}
436 .nf
437 MaxRedirectCount    = 3
438       
439 .fi
440 .if n \{\
441 .RE
442 .\}
443 .SS "setvar <name> <value>"
444 .PP
445 Set the runtime value of a tuneable variable\&.
446 .PP
447 Example: ctdb setvar MaxRedirectCount 5
448 .SS "listvars"
449 .PP
450 List all tuneable variables\&.
451 .PP
452 Example: ctdb listvars
453 .PP
454 Example output:
455 .sp
456 .if n \{\
457 .RS 4
458 .\}
459 .nf
460 MaxRedirectCount    = 3
461 SeqnumInterval      = 1000
462 ControlTimeout      = 60
463 TraverseTimeout     = 20
464 KeepaliveInterval   = 5
465 KeepaliveLimit      = 5
466 RecoverTimeout      = 20
467 RecoverInterval     = 1
468 ElectionTimeout     = 3
469 TakeoverTimeout     = 9
470 MonitorInterval     = 15
471 TickleUpdateInterval = 20
472 EventScriptTimeout  = 30
473 EventScriptTimeoutCount = 1
474 EventScriptUnhealthyOnTimeout = 0
475 RecoveryGracePeriod = 120
476 RecoveryBanPeriod   = 300
477 DatabaseHashSize    = 100001
478 DatabaseMaxDead     = 5
479 RerecoveryTimeout   = 10
480 EnableBans          = 1
481 DeterministicIPs    = 1
482 ReclockPingPeriod   = 60
483 NoIPFailback        = 0
484 DisableIPFailover   = 0
485 VerboseMemoryNames  = 0
486 RecdPingTimeout     = 60
487 RecdFailCount       = 10
488 LogLatencyMs        = 0
489 RecLockLatencyMs    = 1000
490 RecoveryDropAllIPs  = 120
491 VerifyRecoveryLock  = 1
492 VacuumDefaultInterval = 10
493 VacuumMaxRunTime    = 30
494 RepackLimit         = 10000
495 VacuumLimit         = 5000
496 VacuumMinInterval   = 10
497 VacuumMaxInterval   = 10
498 VacuumFastPathCount = 60
499 MaxQueueDropMsg     = 1000000
500 UseStatusEvents     = 0
501 AllowUnhealthyDBRead = 0
502 StatHistoryInterval = 1
503 DeferredAttachTO    = 120
504       
505 .fi
506 .if n \{\
507 .RE
508 .\}
509 .SS "lvsmaster"
510 .PP
511 This command shows which node is currently the LVSMASTER\&. The LVSMASTER is the node in the cluster which drives the LVS system and which receives all incoming traffic from clients\&.
512 .PP
513 LVS is the mode where the entire CTDB/Samba cluster uses a single ip address for the entire cluster\&. In this mode all clients connect to one specific node which will then multiplex/loadbalance the clients evenly onto the other nodes in the cluster\&. This is an alternative to using public ip addresses\&. See the manpage for ctdbd for more information about LVS\&.
514 .SS "lvs"
515 .PP
516 This command shows which nodes in the cluster are currently active in the LVS configuration\&. I\&.e\&. which nodes we are currently loadbalancing the single ip address across\&.
517 .PP
518 LVS will by default only loadbalance across those nodes that are both LVS capable and also HEALTHY\&. Except if all nodes are UNHEALTHY in which case LVS will loadbalance across all UNHEALTHY nodes as well\&. LVS will never use nodes that are DISCONNECTED, STOPPED, BANNED or DISABLED\&.
519 .PP
520 Example output:
521 .sp
522 .if n \{\
523 .RS 4
524 .\}
525 .nf
526 2:10\&.0\&.0\&.13
527 3:10\&.0\&.0\&.14
528       
529 .fi
530 .if n \{\
531 .RE
532 .\}
533 .SS "getcapabilities"
534 .PP
535 This command shows the capabilities of the current node\&. Please see manpage for ctdbd for a full list of all capabilities and more detailed description\&.
536 .PP
537 RECMASTER and LMASTER capabilities are primarily used when CTDBD is used to create a cluster spanning across WAN links\&. In which case ctdbd acts as a WAN accelerator\&.
538 .PP
539 LVS capabile means that the node is participating in LVS, a mode where the entire CTDB cluster uses one single ip address for the entire cluster instead of using public ip address failover\&. This is an alternative to using a loadbalancing layer\-4 switch\&.
540 .PP
541 Example output:
542 .sp
543 .if n \{\
544 .RS 4
545 .\}
546 .nf
547 RECMASTER: YES
548 LMASTER: YES
549 LVS: NO
550       
551 .fi
552 .if n \{\
553 .RE
554 .\}
555 .SS "statistics"
556 .PP
557 Collect statistics from the CTDB daemon about how many calls it has served\&.
558 .PP
559 Example: ctdb statistics
560 .PP
561 Example output:
562 .sp
563 .if n \{\
564 .RS 4
565 .\}
566 .nf
567 CTDB version 1
568  num_clients                        3
569  frozen                             0
570  recovering                         0
571  client_packets_sent           360489
572  client_packets_recv           360466
573  node_packets_sent             480931
574  node_packets_recv             240120
575  keepalive_packets_sent             4
576  keepalive_packets_recv             3
577  node
578      req_call                       2
579      reply_call                     2
580      req_dmaster                    0
581      reply_dmaster                  0
582      reply_error                    0
583      req_message                   42
584      req_control               120408
585      reply_control             360439
586  client
587      req_call                       2
588      req_message                   24
589      req_control               360440
590  timeouts
591      call                           0
592      control                        0
593      traverse                       0
594  total_calls                        2
595  pending_calls                      0
596  lockwait_calls                     0
597  pending_lockwait_calls             0
598  memory_used                     5040
599  max_hop_count                      0
600  max_call_latency                   4\&.948321 sec
601  max_lockwait_latency               0\&.000000 sec
602       
603 .fi
604 .if n \{\
605 .RE
606 .\}
607 .SS "statisticsreset"
608 .PP
609 This command is used to clear all statistics counters in a node\&.
610 .PP
611 Example: ctdb statisticsreset
612 .SS "getreclock"
613 .PP
614 This command is used to show the filename of the reclock file that is used\&.
615 .PP
616 Example output:
617 .sp
618 .if n \{\
619 .RS 4
620 .\}
621 .nf
622 Reclock file:/gpfs/\&.ctdb/shared
623       
624 .fi
625 .if n \{\
626 .RE
627 .\}
628 .SS "setreclock [filename]"
629 .PP
630 This command is used to modify, or clear, the file that is used as the reclock file at runtime\&. When this command is used, the reclock file checks are disabled\&. To re\-enable the checks the administrator needs to activate the "VerifyRecoveryLock" tunable using "ctdb setvar"\&.
631 .PP
632 If run with no parameter this will remove the reclock file completely\&. If run with a parameter the parameter specifies the new filename to use for the recovery lock\&.
633 .PP
634 This command only affects the runtime settings of a ctdb node and will be lost when ctdb is restarted\&. For persistent changes to the reclock file setting you must edit /etc/sysconfig/ctdb\&.
635 .SS "getdebug"
636 .PP
637 Get the current debug level for the node\&. the debug level controls what information is written to the log file\&.
638 .PP
639 The debug levels are mapped to the corresponding syslog levels\&. When a debug level is set, only those messages at that level and higher levels will be printed\&.
640 .PP
641 The list of debug levels from highest to lowest are :
642 .PP
643 EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
644 .SS "setdebug <debuglevel>"
645 .PP
646 Set the debug level of a node\&. This controls what information will be logged\&.
647 .PP
648 The debuglevel is one of EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
649 .SS "getpid"
650 .PP
651 This command will return the process id of the ctdb daemon\&.
652 .SS "disable"
653 .PP
654 This command is used to administratively disable a node in the cluster\&. A disabled node will still participate in the cluster and host clustered TDB records but its public ip address has been taken over by a different node and it no longer hosts any services\&.
655 .SS "enable"
656 .PP
657 Re\-enable a node that has been administratively disabled\&.
658 .SS "stop"
659 .PP
660 This command is used to administratively STOP a node in the cluster\&. A STOPPED node is connected to the cluster but will not host any public ip addresse, nor does it participate in the VNNMAP\&. The difference between a DISABLED node and a STOPPED node is that a STOPPED node does not host any parts of the database which means that a recovery is required to stop/continue nodes\&.
661 .SS "continue"
662 .PP
663 Re\-start a node that has been administratively stopped\&.
664 .SS "addip <public_ip/mask> <iface>"
665 .PP
666 This command is used to add a new public ip to a node during runtime\&. This allows public addresses to be added to a cluster without having to restart the ctdb daemons\&.
667 .PP
668 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\&. If you want this change to be permanent you must also update the public addresses file manually\&.
669 .SS "delip <public_ip>"
670 .PP
671 This command is used to remove a public ip from a node during runtime\&. 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\&.
672 .PP
673 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\&. If you want this change to be permanent you must also update the public addresses file manually\&.
674 .SS "moveip <public_ip> <node>"
675 .PP
676 This command can be used to manually fail a public ip address to a specific node\&.
677 .PP
678 In order to manually override the "automatic" distribution of public ip addresses that ctdb normally provides, this command only works when you have changed the tunables for the daemon to:
679 .PP
680 DeterministicIPs = 0
681 .PP
682 NoIPFailback = 1
683 .SS "shutdown"
684 .PP
685 This command will shutdown a specific CTDB daemon\&.
686 .SS "recover"
687 .PP
688 This command will trigger the recovery daemon to do a cluster recovery\&.
689 .SS "ipreallocate"
690 .PP
691 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\&.
692 .SS "setlmasterrole <on|off>"
693 .PP
694 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\&.
695 .PP
696 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\&.
697 .PP
698 Once this setting has been enabled/disabled, you need to perform a recovery for it to take effect\&.
699 .PP
700 See also "ctdb getcapabilities"
701 .SS "setrecmasterrole <on|off>"
702 .PP
703 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\&.
704 .PP
705 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\&.
706 .PP
707 See also "ctdb getcapabilities"
708 .SS "killtcp <srcip:port> <dstip:port>"
709 .PP
710 This command will kill the specified TCP connection by issuing a TCP RST to the srcip:port endpoint\&. This is a command used by the ctdb eventscripts\&.
711 .SS "gratiousarp <ip> <interface>"
712 .PP
713 This command will send out a gratious arp for the specified interface through the specified interface\&. This command is mainly used by the ctdb eventscripts\&.
714 .SS "reloadnodes"
715 .PP
716 This command is used when adding new nodes, or removing existing nodes from an existing cluster\&.
717 .PP
718 Procedure to add a node:
719 .PP
720 1, To expand an existing cluster, first ensure with \*(Aqctdb status\*(Aq that all nodes are up and running and that they are all healthy\&. Do not try to expand a cluster unless it is completely healthy!
721 .PP
722 2, On all nodes, edit /etc/ctdb/nodes and add the new node as the last entry to the file\&. The new node MUST be added to the end of this file!
723 .PP
724 3, Verify that all the nodes have identical /etc/ctdb/nodes files after you edited them and added the new node!
725 .PP
726 4, Run \*(Aqctdb reloadnodes\*(Aq to force all nodes to reload the nodesfile\&.
727 .PP
728 5, Use \*(Aqctdb status\*(Aq on all nodes and verify that they now show the additional node\&.
729 .PP
730 6, Install and configure the new node and bring it online\&.
731 .PP
732 Procedure to remove a node:
733 .PP
734 1, To remove a node from an existing cluster, first ensure with \*(Aqctdb status\*(Aq that all nodes, except the node to be deleted, are up and running and that they are all healthy\&. Do not try to remove a node from a cluster unless the cluster is completely healthy!
735 .PP
736 2, Shutdown and poweroff the node to be removed\&.
737 .PP
738 3, On all other nodes, edit the /etc/ctdb/nodes file and comment out the node to be removed\&. Do not delete the line for that node, just comment it out by adding a \*(Aq#\*(Aq at the beginning of the line\&.
739 .PP
740 4, Run \*(Aqctdb reloadnodes\*(Aq to force all nodes to reload the nodesfile\&.
741 .PP
742 5, Use \*(Aqctdb status\*(Aq on all nodes and verify that the deleted node no longer shows up in the list\&.\&.
743 .PP
744 .SS "tickle <srcip:port> <dstip:port>"
745 .PP
746 This command will will send a TCP tickle to the source host for the specified TCP connection\&. A TCP tickle is a TCP ACK packet with an invalid sequence and acknowledge number and will when received by the source host result in it sending an immediate correct ACK back to the other end\&.
747 .PP
748 TCP tickles are useful to "tickle" clients after a IP failover has occured since this will make the client immediately recognize the TCP connection has been disrupted and that the client will need to reestablish\&. This greatly speeds up the time it takes for a client to detect and reestablish after an IP failover in the ctdb cluster\&.
749 .SS "gettickles <ip>"
750 .PP
751 This command is used to show which TCP connections are registered with CTDB to be "tickled" if there is a failover\&.
752 .SS "repack [max_freelist]"
753 .PP
754 Over time, when records are created and deleted in a TDB, the TDB list of free space will become fragmented\&. This can lead to a slowdown in accessing TDB records\&. This command is used to defragment a TDB database and pruning the freelist\&.
755 .PP
756 If [max_freelist] is specified, then a database will only be repacked if it has more than this number of entries in the freelist\&.
757 .PP
758 During repacking of the database, the entire TDB database will be locked to prevent writes\&. If samba tries to write to a record in the database during a repack operation, samba will block until the repacking has completed\&.
759 .PP
760 This command can be disruptive and can cause samba to block for the duration of the repack operation\&. In general, a repack operation will take less than one second to complete\&.
761 .PP
762 A repack operation will only defragment the local TDB copy of the CTDB database\&. You need to run this command on all of the nodes to repack a CTDB database completely\&.
763 .PP
764 Example: ctdb repack 1000
765 .PP
766 By default, this operation is issued from the 00\&.ctdb event script every 5 minutes\&.
767 .SS "vacuum [max_records]"
768 .PP
769 Over time CTDB databases will fill up with empty deleted records which will lead to a progressive slow down of CTDB database access\&. This command is used to prune all databases and delete all empty records from the cluster\&.
770 .PP
771 By default, vacuum will delete all empty records from all databases\&. If [max_records] is specified, the command will only delete the first [max_records] empty records for each database\&.
772 .PP
773 Vacuum only deletes records where the local node is the lmaster\&. To delete all records from the entire cluster you need to run a vacuum from each node\&. This command is not disruptive\&. Samba is unaffected and will still be able to read/write records normally while the database is being vacuumed\&.
774 .PP
775 Example: ctdb vacuum
776 .PP
777 By default, this operation is issued from the 00\&.ctdb event script every 5 minutes\&.
778 .SS "backupdb <dbname> <file>"
779 .PP
780 This command can be used to copy the entire content of a database out to a file\&. This file can later be read back into ctdb using the restoredb command\&. This is mainly useful for backing up persistent databases such as secrets\&.tdb and similar\&.
781 .SS "restoredb <file> [<dbname>]"
782 .PP
783 This command restores a persistent database that was previously backed up using backupdb\&. By default the data will be restored back into the same database as it was created from\&. By specifying dbname you can restore the data into a different database\&.
784 .SS "wipedb <dbname>"
785 .PP
786 This command can be used to remove all content of a database\&.
787 .SS "getlog <level>"
788 .PP
789 In addition to the normal loggign to a log file, CTDBD also keeps a in\-memory ringbuffer containing the most recent log entries for all log levels (except DEBUG)\&.
790 .PP
791 This is useful since it allows for keeping continuous logs to a file at a reasonable non\-verbose level, but shortly after an incident has occured, a much more detailed log can be pulled from memory\&. This can allow you to avoid having to reproduce an issue due to the on\-disk logs being of insufficient detail\&.
792 .PP
793 This command extracts all messages of level or lower log level from memory and prints it to the screen\&.
794 .SS "clearlog"
795 .PP
796 This command clears the in\-memory logging ringbuffer\&.
797 .SH "DEBUGGING COMMANDS"
798 .PP
799 These commands are primarily used for CTDB development and testing and should not be used for normal administration\&.
800 .SS "process\-exists <pid>"
801 .PP
802 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\&.
803 .SS "getdbmap"
804 .PP
805 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\&.
806 .PP
807 If a PERSISTENT database is not in a healthy state the database is flagged as UNHEALTHY\&. If there\*(Aqs at least one completely healthy node running in the cluster, it\*(Aqs possible that the content is restored by a recovery run automaticly\&. Otherwise an administrator needs to analyze the problem\&.
808 .PP
809 See also "ctdb getdbstatus", "ctdb backupdb", "ctdb restoredb", "ctdb dumpbackup", "ctdb wipedb", "ctdb setvar AllowUnhealthyDBRead 1" and (if samba or tdb\-utils are installed) "tdbtool check"\&.
810 .PP
811 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\&.
812 .PP
813 Example: ctdb getdbmap
814 .PP
815 Example output:
816 .sp
817 .if n \{\
818 .RS 4
819 .\}
820 .nf
821 Number of databases:10
822 dbid:0x435d3410 name:notify\&.tdb path:/var/ctdb/notify\&.tdb\&.0 
823 dbid:0x42fe72c5 name:locking\&.tdb path:/var/ctdb/locking\&.tdb\&.0
824 dbid:0x1421fb78 name:brlock\&.tdb path:/var/ctdb/brlock\&.tdb\&.0 
825 dbid:0x17055d90 name:connections\&.tdb path:/var/ctdb/connections\&.tdb\&.0 
826 dbid:0xc0bdde6a name:sessionid\&.tdb path:/var/ctdb/sessionid\&.tdb\&.0 
827 dbid:0x122224da name:test\&.tdb path:/var/ctdb/test\&.tdb\&.0 
828 dbid:0x2672a57f name:idmap2\&.tdb path:/var/ctdb/persistent/idmap2\&.tdb\&.0 PERSISTENT
829 dbid:0xb775fff6 name:secrets\&.tdb path:/var/ctdb/persistent/secrets\&.tdb\&.0 PERSISTENT
830 dbid:0xe98e08b6 name:group_mapping\&.tdb path:/var/ctdb/persistent/group_mapping\&.tdb\&.0 PERSISTENT
831 dbid:0x7bbbd26c name:passdb\&.tdb path:/var/ctdb/persistent/passdb\&.tdb\&.0 PERSISTENT
832       
833 .fi
834 .if n \{\
835 .RE
836 .\}
837 .PP
838 Example output for an unhealthy database:
839 .sp
840 .if n \{\
841 .RS 4
842 .\}
843 .nf
844 Number of databases:1
845 dbid:0xb775fff6 name:secrets\&.tdb path:/var/ctdb/persistent/secrets\&.tdb\&.0 PERSISTENT UNHEALTHY
846       
847 .fi
848 .if n \{\
849 .RE
850 .\}
851 .PP
852 Example output for a healthy database as machinereadable output \-Y:
853 .sp
854 .if n \{\
855 .RS 4
856 .\}
857 .nf
858 :ID:Name:Path:Persistent:Unhealthy:
859 :0x7bbbd26c:passdb\&.tdb:/var/ctdb/persistent/passdb\&.tdb\&.0:1:0:
860       
861 .fi
862 .if n \{\
863 .RE
864 .\}
865 .SS "getdbstatus <dbname>"
866 .PP
867 This command displays more details about a database\&.
868 .PP
869 Example: ctdb getdbstatus test\&.tdb\&.0
870 .PP
871 Example output:
872 .sp
873 .if n \{\
874 .RS 4
875 .\}
876 .nf
877 dbid: 0x122224da
878 name: test\&.tdb
879 path: /var/ctdb/test\&.tdb\&.0
880 PERSISTENT: no
881 HEALTH: OK
882       
883 .fi
884 .if n \{\
885 .RE
886 .\}
887 .PP
888 Example: ctdb getdbstatus registry\&.tdb (with a corrupted TDB)
889 .PP
890 Example output:
891 .sp
892 .if n \{\
893 .RS 4
894 .\}
895 .nf
896 dbid: 0xf2a58948
897 name: registry\&.tdb
898 path: /var/ctdb/persistent/registry\&.tdb\&.0
899 PERSISTENT: yes
900 HEALTH: NO\-HEALTHY\-NODES \- ERROR \- Backup of corrupted TDB in \*(Aq/var/ctdb/persistent/registry\&.tdb\&.0\&.corrupted\&.20091208091949\&.0Z\*(Aq
901       
902 .fi
903 .if n \{\
904 .RE
905 .\}
906 .SS "catdb <dbname>"
907 .PP
908 This command will dump a clustered TDB database to the screen\&. This is a debugging command\&.
909 .SS "cattdb <dbname>"
910 .PP
911 This command will dump the content of the local TDB database to the screen\&. This is a debugging command\&.
912 .SS "dumpdbbackup <backup\-file>"
913 .PP
914 This command will dump the content of database backup to the screen (similar to ctdb catdb)\&. This is a debugging command\&.
915 .SS "getmonmode"
916 .PP
917 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\&.
918 .PP
919 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\&.
920 .PP
921 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\&.
922 .SS "setmonmode <0|1>"
923 .PP
924 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\&.
925 .SS "attach <dbname> [persistent]"
926 .PP
927 This is a debugging command\&. This command will make the CTDB daemon create a new CTDB database and attach to it\&.
928 .SS "dumpmemory"
929 .PP
930 This is a debugging command\&. This command will make the ctdb daemon to write a fill memory allocation map to standard output\&.
931 .SS "rddumpmemory"
932 .PP
933 This is a debugging command\&. This command will dump the talloc memory allocation tree for the recovery daemon to standard output\&.
934 .SS "thaw"
935 .PP
936 Thaw a previously frozen node\&.
937 .SS "eventscript <arguments>"
938 .PP
939 This is a debugging command\&. This command can be used to manually invoke and run the eventscritps with arbitrary arguments\&.
940 .SS "ban <bantime|0>"
941 .PP
942 Administratively ban a node for bantime seconds\&. A bantime of 0 means that the node should be permanently banned\&.
943 .PP
944 A banned node does not participate in the cluster and does not host any records for the clustered TDB\&. Its ip address has been taken over by another node and no services are hosted\&.
945 .PP
946 Nodes are automatically banned if they are the cause of too many cluster recoveries\&.
947 .PP
948 This is primarily a testing command\&. Note that the recovery daemon controls the overall ban state and it may automatically unban nodes at will\&. Meaning that a node that has been banned by the administrator can and ofter are unbanned before the admin specifid timeout triggers\&. If wanting to "drop" a node out from the cluster for mainentance or other reasons, use the "stop" / "continue" commands instad of "ban" / "unban"\&.
949 .SS "unban"
950 .PP
951 This command is used to unban a node that has either been administratively banned using the ban command or has been automatically banned by the recovery daemon\&.
952 .SH "SEE ALSO"
953 .PP
954 ctdbd(1), onnode(1)
955 \m[blue]\fB\%http://ctdb.samba.org/\fR\m[]
956 .SH "COPYRIGHT/LICENSE"
957 .sp
958 .if n \{\
959 .RS 4
960 .\}
961 .nf
962 Copyright (C) Andrew Tridgell 2007
963 Copyright (C) Ronnie sahlberg 2007
964
965 This program is free software; you can redistribute it and/or modify
966 it under the terms of the GNU General Public License as published by
967 the Free Software Foundation; either version 3 of the License, or (at
968 your option) any later version\&.
969
970 This program is distributed in the hope that it will be useful, but
971 WITHOUT ANY WARRANTY; without even the implied warranty of
972 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&.  See the GNU
973 General Public License for more details\&.
974
975 You should have received a copy of the GNU General Public License
976 along with this program; if not, see http://www\&.gnu\&.org/licenses/\&.
977 .fi
978 .if n \{\
979 .RE
980 .\}