merge from tridge
[sahlberg/ctdb.git] / doc / ctdbd.1.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="ctdbd.1">
4
5 <refmeta>
6         <refentrytitle>ctdbd</refentrytitle>
7         <manvolnum>1</manvolnum>
8 </refmeta>
9
10
11 <refnamediv>
12         <refname>ctdbd</refname>
13         <refpurpose>The CTDB cluster daemon</refpurpose>
14 </refnamediv>
15
16 <refsynopsisdiv>
17         <cmdsynopsis>
18                 <command>ctdbd</command>
19         </cmdsynopsis>
20         
21         <cmdsynopsis>
22                 <command>ctdbd</command>
23                 <arg choice="req">--reclock=&lt;filename&gt;</arg>
24                 <arg choice="req">--nlist=&lt;filename&gt;</arg>
25                 <arg choice="req">--dbdir=&lt;directory&gt;</arg>
26                 <arg choice="opt">-? --help</arg>
27                 <arg choice="opt">--usage</arg>
28                 <arg choice="opt">-i --interactive</arg>
29                 <arg choice="opt">--public-addresses=&lt;filename&gt;</arg>
30                 <arg choice="opt">--public-interface=&lt;interface&gt;</arg>
31                 <arg choice="opt">--event-script=&lt;filename&gt;</arg>
32                 <arg choice="opt">--logfile=&lt;filename&gt;</arg>
33                 <arg choice="opt">--listen=&lt;address&gt;</arg>
34                 <arg choice="opt">--transport=&lt;STRING&gt;</arg>
35                 <arg choice="opt">--socket=&lt;filename&gt;</arg>
36                 <arg choice="opt">-d --debug=&lt;INTEGER&gt;</arg>
37                 <arg choice="opt">--torture</arg>
38         </cmdsynopsis>
39         
40 </refsynopsisdiv>
41
42   <refsect1><title>DESCRIPTION</title>
43     <para>
44       ctdbd is the main ctdb daemon.
45     </para>
46     <para>
47       ctdbd provides a clustered version of the TDB database with automatic rebuild/recovery of the databases upon nodefailures.
48     </para>
49     <para>
50       Combined with a cluster filesystem ctdbd provides a full HA environment for services such as clustered Samba and NFS as well as other services.
51     </para>
52     <para>
53       ctdbd provides monitoring of all nodes in the cluster and automatically reconfigures the cluster and recovers upon node failures.
54     </para>
55     <para>
56       ctdbd is the main component in clustered Samba that provides a high-awailability load-sharing CIFS server cluster.
57     </para>
58   </refsect1>
59
60
61   <refsect1>
62     <title>OPTIONS</title>
63
64     <variablelist>
65       <varlistentry><term>-? --help</term>
66         <listitem>
67           <para>
68             Print some help text to the screen.
69           </para>
70         </listitem>
71       </varlistentry>
72
73       <varlistentry><term>--usage</term>
74         <listitem>
75           <para>
76             Print useage information to the screen.
77           </para>
78         </listitem>
79       </varlistentry>
80
81       <varlistentry><term>--reclock=&lt;filename&gt;</term>
82         <listitem>
83           <para>
84             This is the name of the lock file stored of the shared cluster filesystem that ctdbd uses to arbitrate which node has the role of recovery-master.
85             This file must be stored on shared storage.
86           </para>
87         </listitem>
88       </varlistentry>
89
90       <varlistentry><term>--nlist=&lt;filename&gt;</term>
91         <listitem>
92           <para>
93             This file contains a list of the private ip addresses of every node in the cluster. There is one line/ip address for each node. This file must be the same for all nodes in the cluster.
94           </para>
95           <para>
96             This file is usually /etc/ctdb/nodes .
97           </para>
98         </listitem>
99       </varlistentry>
100
101       <varlistentry><term>--dbdir=&lt;directory&gt;</term>
102         <listitem>
103           <para>
104             This is the directory on local storage where ctdbd keeps the local
105             copy of the TDB databases. This directory is local for each node and should not be stored on the shared cluster filesystem.
106           </para>
107           <para>
108             This directory would usually be /var/ctdb .
109           </para>
110         </listitem>
111       </varlistentry>
112
113       <varlistentry><term>-i --interactive</term>
114         <listitem>
115           <para>
116             By default ctdbd will detach itself from the shell and run in
117             the background as a daemon. This option makes ctdbd to start in interactive mode.
118           </para>
119         </listitem>
120       </varlistentry>
121
122       <varlistentry><term>--public_addresses=&lt;filename&gt;</term>
123         <listitem>
124           <para>
125             When used with IP takeover this specifies a file containing the public ip addresses to use on the cluster. This file contains one entry for each node in the cluster.
126           </para>
127           <para>
128             This is usually the file /etc/ctdb/public_addresses
129           </para>
130         </listitem>
131       </varlistentry>
132
133       <varlistentry><term>--public-interface=&lt;interface&gt;</term>
134         <listitem>
135           <para>
136             When used with IP takeover this option specifies which physical interface should be used to attach the public addresses to.
137           </para>
138         </listitem>
139       </varlistentry>
140
141       <varlistentry><term>--event-script=&lt;filename&gt;</term>
142         <listitem>
143           <para>
144             This option is used to specify which events script that ctdbd will
145             use to manage services when the cluster configuration changes.
146           </para>
147           <para>
148             This will normally be /etc/ctdb/events which is part of the ctdb distribution.
149           </para>
150         </listitem>
151       </varlistentry>
152
153       <varlistentry><term>--logfile=&lt;filename&gt;</term>
154         <listitem>
155           <para>
156             This is the file where ctdbd will write its log. This is usually /var/log/log.ctdb .
157           </para>
158         </listitem>
159       </varlistentry>
160
161       <varlistentry><term>--listen=&lt;address&gt;</term>
162         <listitem>
163           <para>
164             This specifies which ip address ctdb will bind to. By default ctdbd will bind to the first address it finds in the /etc/ctdb/nodes file and which is also present on the local system in which case you do not need to provide this option.
165           </para>
166           <para>
167             This option is only required when you want to run multiple ctdbd daemons/nodes on the same physical host in which case there would be multiple entries in /etc/ctdb/nodes what would match a local interface.
168           </para>
169         </listitem>
170       </varlistentry>
171
172       <varlistentry><term>--transport=&lt;STRING&gt;</term>
173         <listitem>
174           <para>
175             This option specifies which transport to use for ctdbd internode communications. The default is "tcp".
176           </para>
177           <para>
178             Suported transports are "tcp" and "infiniband".
179           </para>
180         </listitem>
181       </varlistentry>
182
183       <varlistentry><term>--socket=&lt;filename&gt;</term>
184         <listitem>
185           <para>
186             This specifies the name of the domain socket that ctdbd will create. This socket is used for local clients to attach to and communicate with the ctdbd daemon.
187           </para>
188           <para>
189             The default is /tmp/ctdb.socket . You only need to use this option if you plan to run multiple ctdbd daemons on the same physical host.
190           </para>
191         </listitem>
192       </varlistentry>
193
194       <varlistentry><term>-d --debug=&lt;DEBUGLEVEL&gt;</term>
195         <listitem>
196           <para>
197             This option sets the debuglevel on the ctdbd daemon which controls what will be written to the logfile. The default is 0 which will only log important events and errors. A larger number will provide additional logging.
198           </para>
199         </listitem>
200       </varlistentry>
201
202       <varlistentry><term>--torture</term>
203         <listitem>
204           <para>
205             This option is only used for development and testing of ctdbd. It adds artificial errors and failures to the common codepaths in ctdbd to verify that ctdbd can recover correctly for failures.
206           </para>
207           <para>
208             You do NOT want to use this option unless you are developing and testing new functionality in ctdbd.
209           </para>
210         </listitem>
211       </varlistentry>
212     </variablelist>
213   </refsect1>
214
215
216   <refsect1><title>Private vs Public addresses</title>
217     <para>
218       When used for ip takeover in a HA environment, each node in a ctdb 
219       cluster has two ip addresses assigned to it. One private and one public.
220     </para>
221
222     <refsect2><title>Private address</title>
223       <para>
224         This is the physical ip address of the node which is configured in 
225         linux and attached to a physical interface. This address uniquely
226         identifies a physical node in the cluster and is the ip addresses
227         that ctdbd will use to communicate with the ctdbd daemons on the
228         other nodes in the cluster.
229       </para>
230       <para>
231         The private addresses are configured in /etc/ctdb/nodes 
232         (unless the --nlist option is used) and contain one line for each 
233         node in the cluster. Each line contains the private ip address for one
234         node in the cluster.
235       </para>
236       <para>
237         Each node is assigned an internal node number which corresponds to 
238         which line in the nodes file that has the local private address
239         of the node.
240       </para>
241       <para>
242         Since the private addresses are only available to the network when the
243         corresponding node is up and running you should not use these addresses
244         for clients to connect to services provided by the cluster. Instead
245         client applications should only attach to the public addresses since
246         these are guaranteed to always be available.
247       </para>
248       Example /etc/ctdb/nodes for a four node cluster:
249       <screen format="linespecific">
250         10.1.1.1
251         10.1.1.2
252         10.1.1.3
253         10.1.1.4
254       </screen>
255     </refsect2>
256     <refsect2><title>Public address</title>
257       <para>
258         A public address on the other hand is not attached to an interface.
259         This address is managed by ctdbd itself and is attached/detached to
260         a physical node at runtime. You should NOT have this address configured
261         to an interface in linux. Let ctdbd manage these addresses.
262       </para>
263       <para>
264         The ctdb cluster will assign/reassign these public addresses across the
265         available nodes in the cluster. When one node fails, its public address
266         will be migrated to and taken over by a different node in the cluster
267         to ensure that all public addresses are always available to clients.
268       </para>
269       <para>
270         These addresses are not physically attached to a specific node. 
271         The 'ctdb ip' command can be used to view the current assignment of 
272         public addresses and which physical node is currently serving it.
273       </para>
274       <para>
275         By default, each node will when operational always serve its primary 
276         public address which is the corresponding line for that node number 
277         in the public addresses file. I.e. as long as node X is available and
278         fully oprational it will always be the node that serves the 
279         corresponding public address.
280       </para>
281       <para>
282         The list of public addresses also contain the netmask for that address.
283         the reason for this is because ctdbd needs to know which mask to use
284         when it adds/removes the address from a physical node. This netmask
285         is also used by ctdbd when making decisions on which node should take
286         over a public ip address for a failed node.
287         A node will only be allowed to take over a public address from a
288         different node IFF that public address resides in the same subnet
289         as the primary public address for that node.
290       </para>
291       Example /etc/ctdb/public_addresses for a four node cluster:
292       <screen format="linespecific">
293         11.1.1.1/24
294         11.1.1.2/24
295         11.1.2.1/24
296         11.1.2.2/24
297       </screen>
298       <para>
299         In this example, if node 3 fails, its public address can be taken over 
300         by node 2 since node 2 is on the same subnet as 3 but not by node 0 or 
301         node 1 since node 0 and 1 are both on a different subnet from node 3.
302       </para>
303     </refsect2>
304   </refsect1>
305
306
307   <refsect1><title>Node status</title>
308     <para>
309       The current status of each node in the cluster can be viewed by the 
310       'ctdb status' command.
311     </para>
312     <para>
313       There are five possible for a node.
314     </para>
315
316     <para>
317       OK - This node is fully functional.
318     </para>
319     
320     <para>
321       DISCONNECTED - This node could not be connected through the network 
322       and is currently not parcipitating in the cluster. If there is a 
323       public IP address associated with this node it should have been taken 
324       over by a different node. No services are running on this node.
325     </para>
326  
327     <para>
328       DISABLED - This node has been administratively disabled. This node is 
329       still functional and participates in the CTDB cluster but its IP 
330       addresses have been taken over by a different node and no services are 
331       currently being hosted.
332     </para>
333    
334     <para>
335       UNHEALTHY - A service provided by this node is malfunctioning and should 
336       be investigated. The CTDB daemon itself is operational and participates 
337       in the cluster. Its public IP address has been taken over by a different 
338       node and no services are currently being hosted. All unhealthy nodes 
339       should be investigated and require an administrative action to rectify.
340     </para>
341     
342     <para>
343       BANNED - This node failed too many recovery attempts and has been banned 
344       from participating in the cluster for a period of RecoveryBanPeriod 
345       seconds. Any public IP address has been taken over by other nodes. This 
346       node does not provide any services. All banned nodes should be 
347       investigated and require an administrative action to rectify. This node 
348       does not perticipate in the CTDB cluster but can still be communicated 
349       with. I.e. ctdb commands can be sent to it.
350     </para>
351   </refsect1>
352
353
354   <refsect1><title>SEE ALSO</title>
355     <para>
356       ctdb(1), onnode(1)
357       <ulink url="http://ctdb.samba.org/"/>
358     </para>
359   </refsect1>
360   <refsect1><title>COPYRIGHT/LICENSE</title>
361 <literallayout>
362 Copyright (C) Andrew Tridgell 2007
363 Copyright (C) Ronnie sahlberg 2007
364
365 This program is free software; you can redistribute it and/or modify
366 it under the terms of the GNU General Public License as published by
367 the Free Software Foundation; either version 2 of the License, or (at
368 your option) any later version.
369
370 This program is distributed in the hope that it will be useful, but
371 WITHOUT ANY WARRANTY; without even the implied warranty of
372 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
373 General Public License for more details.
374
375 You should have received a copy of the GNU General Public License
376 along with this program; if not, write to the Free Software
377 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
378 </literallayout>
379   </refsect1>
380 </refentry>