LVS
[sahlberg/ctdb.git] / web / configuring.html
1 <!--#set var="TITLE" value="Configuring CTDB" -->
2 <!--#include virtual="header.html" -->
3
4 <H2 align="center">Configuring CTDB</H2>
5
6 <h2>Clustering Model</h2>
7
8 The setup instructions on this page are modelled on setting up a cluster of N 
9 nodes that function in nearly all respects as a single multi-homed node. 
10 So the cluster will export N IP interfaces, each of which is equivalent 
11 (same shares) and which offers coherent CIFS file access across all 
12 nodes.<p>
13
14 The clustering model utilizes IP takeover techniques to ensure that
15 the full set of public IP addresses assigned to services on the
16 cluster will always be available to the clients even when some nodes
17 have failed and become unavailable.
18
19 <h2>CTDB Cluster Configuration</h2>
20
21 These are the primary configuration files for CTDB.<p>
22
23 When CTDB is installed, it will install template versions of these
24 files which you need to edit to suit your system.  The current set of
25 config files for CTDB are also available from
26 <a href="http://samba.org/~tridge/ctdb/config">http://samba.org/~tridge/ctdb/config</a>
27
28 <h3>/etc/sysconfig/ctdb</h3>
29
30 This file contains the startup parameters for ctdb.<p>
31
32 When you installed ctdb, a template config file should have been
33 installed in /etc/sysconfig/ctdb.<p>
34
35 Edit this file, following the instructions in the template.<p>
36
37 The most important options are:
38 <ul>
39 <li>CTDB_NODES
40 <li>CTDB_RECOVERY_LOCK
41 <li>CTDB_PUBLIC_ADDRESSES
42 </ul>
43
44 Please verify these parameters carefully.
45
46 <h4>CTDB_RECOVERY_LOCK</h4>
47
48 This parameter specifies the lock file that the CTDB daemons use to arbitrate 
49 which node is acting as a recovery master.<br>
50
51 This file MUST be held on shared storage so that all CTDB daemons in the cluster will access/lock the same file.<br><br>
52
53 You <strong>must</strong> specify this parameter.<br>
54 There is no default for this parameter.
55
56 <h3>CTDB_NODES</h3>
57
58 This file needs to be created and should contain a list of the private
59 IP addresses that the CTDB daemons will use in your cluster. One IP
60 address for each node in the cluster.<p>
61
62 This should be a private non-routable subnet which is only used for
63 internal cluster traffic. This file must be the same on all nodes in
64 the cluster.<p>
65
66 Make sure that these IP addresses are automatically started when the
67 cluster node boots and that each node can ping each other node.<p>
68
69 Example 4 node cluster:
70 <pre>
71   CTDB_NODES=/etc/ctdb/nodes
72 </pre>
73 Content of /etc/ctdb/nodes:
74 <pre>
75  10.1.1.1
76  10.1.1.2
77  10.1.1.3
78  10.1.1.4
79 </pre>
80
81 The default for this file is /etc/ctdb/nodes.
82
83
84 <h3>CTDB_PUBLIC_ADDRESSES</h3>
85
86 Each node in a CTDB cluster contains a list of public addresses which that 
87 particular node can host.<p>
88
89 While running the CTDB cluster will assign each public address that exists in the entire cluster to one node that will host that public address.<p>
90
91 These are the addresses that the SMBD daemons and other services will
92 bind to and which clients will use to connect to the cluster.<p>
93
94 <h3>Example 4 node cluster:</h3>
95 <pre>
96   CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
97 </pre>
98 Content of /etc/ctdb/public_addresses:
99 <pre>
100  192.168.1.1/24 eth0
101  192.168.1.2/24 eth0
102  192.168.2.1/24 eth1
103  192.168.2.2/24 eth1
104 </pre>
105
106 These are the IP addresses that you should configure in DNS for the
107 name of the clustered samba server and are the addresses that CIFS
108 clients will connect to.<p>
109
110 Configure it as one DNS A record (==name) with multiple IP addresses
111 and let round-robin DNS distribute the clients across the nodes of the
112 cluster.<p>
113
114 The CTDB cluster utilizes IP takeover techniques to ensure that as long as at least one node in the cluster is available, all the public IP addresses will always be available to clients.<p>
115
116 This means that if one physical node fails, the public addresses that
117 node was serving will be taken over by a different node in the cluster. This
118 provides a guarantee that all ip addresses exposed to clients will
119 always be reachable by clients as long as at least one node still remains available in the cluster with the capability to host that public address (i.e. the public address exists in that nodes public_addresses file).
120
121 Do not assign these addresses to any of the interfaces on the
122 host. CTDB will add and remove these addresses automatically at
123 runtime.<p>
124
125 This parameter is used when CTDB operated in takeover ip mode.<p>
126
127 The usual location for this file is /etc/ctdb/public_addresses.<p><p>
128
129 <h3>Example 2:</h3>
130 By using different public_addresses files on different nodes it is possible to 
131 partition the cluster into subsets of nodes.
132
133 <pre>
134 Node 0 : /etc/ctdb/public_addresses
135 10.1.1.1/24 eth0
136 10.1.2.1/24 eth1
137 </pre>
138
139 <pre>
140 Node 1 : /etc/ctdb/public_addresses
141 10.1.2.1/24 eth1
142 10.1.3.1/24 eth2
143 </pre>
144
145 <pre>
146 Node 2 : /etc/ctdb/public_addresses
147 10.1.3.2/24 eth2
148 </pre>
149
150 In this example we have three nodes but a total of 4 public addresses.<p>
151
152 10.1.2.1 can be hosted by either node 0 or node 1 and will be available to clients as long as at least one of these nodes are available. Only if both nodes 0 and 1 fails will this public address become unavailable to clients.<p>
153
154 All other public addresses can only be served by one single node respectively and will therefore only be avialable if the respective node is also available.
155
156
157 <h2>Event scripts</h2>
158
159 CTDB comes with a number of application specific event scripts that
160 are used to do service specific tasks when the cluster has been
161 reconfigured. These scripts are stored in /etc/ctdb/events.d/<p>
162
163 You do not need to modify these scripts if you just want to use
164 clustered Samba or NFS but they serve as examples in case you want to
165 add clustering support for other application servers we do not yet
166 proivide event scripts for.<p>
167
168 Please see the service scripts that installed by ctdb in
169 /etc/ctdb/events.d for examples of how to configure other services to
170 be aware of the HA features of CTDB.<p>
171
172 Also see /etc/ctdb/events.d/README for additional documentation on how to
173 create and manage event scripts.
174
175 <h2>TCP port to use for CTDB</h2>
176
177 CTDB defaults to use TCP port 4379 for its traffic.<p>
178
179 Configuring a different port to use for CTDB traffic is done by adding
180 a ctdb entry to the /etc/services file.<p>
181
182 Example: for change CTDB to use port 9999 add the following line to /etc/services
183 <pre>
184  ctdb  9999/tcp
185 </pre>
186
187 Note: all nodes in the cluster MUST use the same port or else CTDB
188 will not start correctly.
189
190 <h2>Name resolution</h2>
191
192 You need to setup some method for your Windows and NFS clients to find
193 the nodes of the cluster, and automatically balance the load between
194 the nodes.<p>
195
196 We recommend that you use public ip addresses using
197 CTDB_PUBLIC_INTERFACE/CTDB_PUBLIC_ADDRESSES and that you setup a
198 round-robin DNS entry for your cluster, listing all the public IP
199 addresses that CTDB will be managing as a single DNS A record.<p>
200
201 You may also wish to setup a static WINS server entry listing all of
202 your cluster nodes IP addresses.
203
204 <!--#include virtual="footer.html" -->