Specify and print debuglevels by name and not by number
[metze/ctdb/wip.git] / doc / ctdb.1
1 .\"     Title: ctdb
2 .\"    Author: 
3 .\" Generator: DocBook XSL Stylesheets v1.71.0 <http://docbook.sf.net/>
4 .\"      Date: 02/05/2008
5 .\"    Manual: 
6 .\"    Source: 
7 .\"
8 .TH "CTDB" "1" "02/05/2008" "" ""
9 .\" disable hyphenation
10 .nh
11 .\" disable justification (adjust text to left margin only)
12 .ad l
13 .SH "NAME"
14 ctdb \- clustered tdb database management utility
15 .SH "SYNOPSIS"
16 .HP 29
17 \fBctdb [ OPTIONS ] COMMAND ...\fR
18 .HP 5
19 \fBctdb\fR [\-n\ <node>] [\-Y] [\-t\ <timeout>] [\-T\ <timelimit>] [\-?\ \-\-help] [\-\-usage] [\-d\ \-\-debug=<INTEGER>] [\-\-socket=<filename>]
20 .SH "DESCRIPTION"
21 .PP
22 ctdb is a utility to view and manage a ctdb cluster.
23 .SH "OPTIONS"
24 .PP
25 \-n <pnn>
26 .RS 3n
27 This specifies the physical node number on which to execute the command. Default is to run the command on the deamon running on the local host.
28 .sp
29 The physical node number is an integer that describes the node in the cluster. The first node has physical node number 0.
30 .RE
31 .PP
32 \-Y
33 .RS 3n
34 Produce output in machine readable form for easier parsing by scripts. Not all commands support this option.
35 .RE
36 .PP
37 \-t <timeout>
38 .RS 3n
39 How long should ctdb wait for the local ctdb daemon to respond to a command before timing out. Default is 3 seconds.
40 .RE
41 .PP
42 \-T <timelimit>
43 .RS 3n
44 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.
45 .RE
46 .PP
47 \-? \-\-help
48 .RS 3n
49 Print some help text to the screen.
50 .RE
51 .PP
52 \-\-usage
53 .RS 3n
54 Print useage information to the screen.
55 .RE
56 .PP
57 \-d \-\-debug=<debuglevel>
58 .RS 3n
59 Change the debug level for the command. Default is 0.
60 .RE
61 .PP
62 \-\-socket=<filename>
63 .RS 3n
64 Specify the socketname to use when connecting to the local ctdb daemon. The default is /tmp/ctdb.socket .
65 .sp
66 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.
67 .RE
68 .SH "ADMINISTRATIVE COMMANDS"
69 .PP
70 These are commands used to monitor and administrate a CTDB cluster.
71 .SS "status"
72 .PP
73 This command shows the current status of the ctdb node.
74 .sp
75 .it 1 an-trap
76 .nr an-no-space-flag 1
77 .nr an-break-flag 1
78 .br
79 \fBnode status\fR
80 .RS
81 .PP
82 Node status reflects the current status of the node. There are four possible states:
83 .PP
84 OK \- This node is fully functional.
85 .PP
86 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.
87 .PP
88 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.
89 .PP
90 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.
91 .PP
92 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.
93 .RE
94 .sp
95 .it 1 an-trap
96 .nr an-no-space-flag 1
97 .nr an-break-flag 1
98 .br
99 \fBgeneration\fR
100 .RS
101 .PP
102 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.
103 .PP
104 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.
105 .PP
106 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.
107 .RE
108 .sp
109 .it 1 an-trap
110 .nr an-no-space-flag 1
111 .nr an-break-flag 1
112 .br
113 \fBVNNMAP\fR
114 .RS
115 .PP
116 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.
117 .RE
118 .sp
119 .it 1 an-trap
120 .nr an-no-space-flag 1
121 .nr an-break-flag 1
122 .br
123 \fBRecovery mode\fR
124 .RS
125 .PP
126 This is the current recovery mode of the cluster. There are two possible modes:
127 .PP
128 NORMAL \- The cluster is fully operational.
129 .PP
130 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.
131 .PP
132 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.
133 .PP
134 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.
135 .RE
136 .sp
137 .it 1 an-trap
138 .nr an-no-space-flag 1
139 .nr an-break-flag 1
140 .br
141 \fBRecovery master\fR
142 .RS
143 .PP
144 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.
145 .PP
146 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.
147 .RE
148 .PP
149 Example: ctdb status
150 .PP
151 Example output:
152 .sp
153 .RS 3n
154 .nf
155 Number of nodes:4
156 pnn:0 11.1.2.200       OK (THIS NODE)
157 pnn:1 11.1.2.201       OK
158 pnn:2 11.1.2.202       OK
159 pnn:3 11.1.2.203       OK
160 Generation:1362079228
161 Size:4
162 hash:0 lmaster:0
163 hash:1 lmaster:1
164 hash:2 lmaster:2
165 hash:3 lmaster:3
166 Recovery mode:NORMAL (0)
167 Recovery master:0
168       
169 .fi
170 .RE
171 .SS "ping"
172 .PP
173 This command will "ping" all CTDB daemons in the cluster to verify that they are processing commands correctly.
174 .PP
175 Example: ctdb ping
176 .PP
177 Example output:
178 .sp
179 .RS 3n
180 .nf
181 response from 0 time=0.000054 sec  (3 clients)
182 response from 1 time=0.000144 sec  (2 clients)
183 response from 2 time=0.000105 sec  (2 clients)
184 response from 3 time=0.000114 sec  (2 clients)
185       
186 .fi
187 .RE
188 .SS "ip"
189 .PP
190 This command will display the list of public addresses that are provided by the cluster and which physical node is currently serving this ip.
191 .PP
192 Example: ctdb ip
193 .PP
194 Example output:
195 .sp
196 .RS 3n
197 .nf
198 Number of addresses:4
199 12.1.1.1         0
200 12.1.1.2         1
201 12.1.1.3         2
202 12.1.1.4         3
203       
204 .fi
205 .RE
206 .SS "getvar <name>"
207 .PP
208 Get the runtime value of a tuneable variable.
209 .PP
210 Example: ctdb getvar MaxRedirectCount
211 .PP
212 Example output:
213 .sp
214 .RS 3n
215 .nf
216 MaxRedirectCount    = 3
217       
218 .fi
219 .RE
220 .SS "setvar <name> <value>"
221 .PP
222 Set the runtime value of a tuneable variable.
223 .PP
224 Example: ctdb setvar MaxRedirectCount 5
225 .SS "listvars"
226 .PP
227 List all tuneable variables.
228 .PP
229 Example: ctdb listvars
230 .PP
231 Example output:
232 .sp
233 .RS 3n
234 .nf
235 MaxRedirectCount    = 5
236 SeqnumFrequency     = 1
237 ControlTimeout      = 60
238 TraverseTimeout     = 20
239 KeepaliveInterval   = 2
240 KeepaliveLimit      = 3
241 MaxLACount          = 7
242 RecoverTimeout      = 5
243 RecoverInterval     = 1
244 ElectionTimeout     = 3
245 TakeoverTimeout     = 5
246 MonitorInterval     = 15
247 EventScriptTimeout  = 20
248 RecoveryGracePeriod = 60
249 RecoveryBanPeriod   = 300
250       
251 .fi
252 .RE
253 .SS "statistics"
254 .PP
255 Collect statistics from the CTDB daemon about how many calls it has served.
256 .PP
257 Example: ctdb statistics
258 .PP
259 Example output:
260 .sp
261 .RS 3n
262 .nf
263 CTDB version 1
264  num_clients                        3
265  frozen                             0
266  recovering                         0
267  client_packets_sent           360489
268  client_packets_recv           360466
269  node_packets_sent             480931
270  node_packets_recv             240120
271  keepalive_packets_sent             4
272  keepalive_packets_recv             3
273  node
274      req_call                       2
275      reply_call                     2
276      req_dmaster                    0
277      reply_dmaster                  0
278      reply_error                    0
279      req_message                   42
280      req_control               120408
281      reply_control             360439
282  client
283      req_call                       2
284      req_message                   24
285      req_control               360440
286  timeouts
287      call                           0
288      control                        0
289      traverse                       0
290  total_calls                        2
291  pending_calls                      0
292  lockwait_calls                     0
293  pending_lockwait_calls             0
294  memory_used                     5040
295  max_hop_count                      0
296  max_call_latency                   4.948321 sec
297  max_lockwait_latency               0.000000 sec
298       
299 .fi
300 .RE
301 .SS "statisticsreset"
302 .PP
303 This command is used to clear all statistics counters in a node.
304 .PP
305 Example: ctdb statisticsreset
306 .SS "getdebug"
307 .PP
308 Get the current debug level for the node. the debug level controls what information is written to the log file.
309 .PP
310 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.
311 .PP
312 The list of debug levels from highest to lowest are :
313 .PP
314 EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
315 .SS "setdebug <debuglevel>"
316 .PP
317 Set the debug level of a node. This controls what information will be logged.
318 .PP
319 The debuglevel is one of EMERG ALERT CRIT ERR WARNING NOTICE INFO DEBUG
320 .SS "getpid"
321 .PP
322 This command will return the process id of the ctdb daemon.
323 .SS "disable"
324 .PP
325 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.
326 .SS "enable"
327 .PP
328 Re\-enable a node that has been administratively disabled.
329 .SS "ban <bantime|0>"
330 .PP
331 Administratively ban a node for bantime seconds. A bantime of 0 means that the node should be permanently banned.
332 .PP
333 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 an other node and no services are hosted.
334 .PP
335 Nodes are automatically banned if they are the cause of too many cluster recoveries.
336 .SS "unban"
337 .PP
338 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.
339 .SS "shutdown"
340 .PP
341 This command will shutdown a specific CTDB daemon.
342 .SS "recover"
343 .PP
344 This command will trigger the recovery daemon to do a cluster recovery.
345 .SS "killtcp <srcip:port> <dstip:port>"
346 .PP
347 This command will kill the specified TCP connection by issuing a TCP RST to the srcip:port endpoint.
348 .SS "tickle <srcip:port> <dstip:port>"
349 .PP
350 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.
351 .PP
352 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.
353 .SS "repack [max_freelist]"
354 .PP
355 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.
356 .PP
357 If [max_freelist] is specified, then a database will only be repacked if it has more than this number of entries in the freelist.
358 .PP
359 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.
360 .PP
361 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.
362 .PP
363 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.
364 .PP
365 Example: ctdb repack 1000
366 .PP
367 By default, this operation is issued from the 00.ctdb event script every 5 minutes.
368 .SS "vacuum [max_records]"
369 .PP
370 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.
371 .PP
372 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.
373 .PP
374 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.
375 .PP
376 Example: ctdb vacuum
377 .PP
378 By default, this operation is issued from the 00.ctdb event script every 5 minutes.
379 .SH "DEBUGGING COMMANDS"
380 .PP
381 These commands are primarily used for CTDB development and testing and should not be used for normal administration.
382 .SS "process\-exists <pid>"
383 .PP
384 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.
385 .SS "getdbmap"
386 .PP
387 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.
388 .PP
389 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.
390 .PP
391 Example: ctdb getdbmap
392 .PP
393 Example output:
394 .sp
395 .RS 3n
396 .nf
397 Number of databases:10
398 dbid:0x435d3410 name:notify.tdb path:/var/ctdb/notify.tdb.0 
399 dbid:0x42fe72c5 name:locking.tdb path:/var/ctdb/locking.tdb.0 dbid:0x1421fb78 name:brlock.tdb path:/var/ctdb/brlock.tdb.0 
400 dbid:0x17055d90 name:connections.tdb path:/var/ctdb/connections.tdb.0 
401 dbid:0xc0bdde6a name:sessionid.tdb path:/var/ctdb/sessionid.tdb.0 
402 dbid:0x122224da name:test.tdb path:/var/ctdb/test.tdb.0 
403 dbid:0x2672a57f name:idmap2.tdb path:/var/ctdb/persistent/idmap2.tdb.0 PERSISTENT
404 dbid:0xb775fff6 name:secrets.tdb path:/var/ctdb/persistent/secrets.tdb.0 PERSISTENT
405 dbid:0xe98e08b6 name:group_mapping.tdb path:/var/ctdb/persistent/group_mapping.tdb.0 PERSISTENT
406 dbid:0x7bbbd26c name:passdb.tdb path:/var/ctdb/persistent/passdb.tdb.0 PERSISTENT
407       
408 .fi
409 .RE
410 .SS "catdb <dbname>"
411 .PP
412 This command will dump a clustered TDB database to the screen. This is a debugging command.
413 .SS "getmonmode"
414 .PP
415 This command returns the monutoring mode of a node. The monitoring mode is either ACTIVE or DISABLED. Normally a node will continously monitor that all other nodes that are expected are in fact connected and that they respond to commands.
416 .PP
417 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.
418 .PP
419 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.
420 .SS "setmonmode <0|1>"
421 .PP
422 This command can be used to explicitely 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.
423 .SS "attach <dbname>"
424 .PP
425 This is a debugging command. This command will make the CTDB daemon create a new CTDB database and attach to it.
426 .SS "dumpmemory"
427 .PP
428 This is a debugging command. This command will make the ctdb daemon to write a fill memory allocation map to standard output.
429 .SS "freeze"
430 .PP
431 This command will lock all the local TDB databases causing clients that are accessing these TDBs such as samba3 to block until the databases are thawed.
432 .PP
433 This is primarily used by the recovery daemon to stop all samba daemons from accessing any databases while the database is recovered and rebuilt.
434 .SS "thaw"
435 .PP
436 Thaw a previously frozen node.
437 .SH "SEE ALSO"
438 .PP
439 ctdbd(1), onnode(1)
440 \fI\%http://ctdb.samba.org/\fR
441 .SH "COPYRIGHT/LICENSE"
442 .sp
443 .RS 3n
444 .nf
445 Copyright (C) Andrew Tridgell 2007
446 Copyright (C) Ronnie sahlberg 2007
447
448 This program is free software; you can redistribute it and/or modify
449 it under the terms of the GNU General Public License as published by
450 the Free Software Foundation; either version 3 of the License, or (at
451 your option) any later version.
452
453 This program is distributed in the hope that it will be useful, but
454 WITHOUT ANY WARRANTY; without even the implied warranty of
455 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
456 General Public License for more details.
457
458 You should have received a copy of the GNU General Public License
459 along with this program; if not, see http://www.gnu.org/licenses/.
460 .fi
461 .RE