12.4. CTDB Configuration
The CTDB configuration file is located at
/etc/sysconfig/ctdb
. The mandatory fields that must be configured for CTDB operation are as follows:
CTDB_NODES
CTDB_PUBLIC_ADDRESSES
CTDB_RECOVERY_LOCK
CTDB_MANAGES_SAMBA
(must be enabled)CTDB_MANAGES_WINBIND
(must be enabled if running on a member server)
The following example shows a configuration file with the mandatory fields for CTDB operation set with example parameters:
CTDB_NODES=/etc/ctdb/nodes CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses CTDB_RECOVERY_LOCK="/mnt/ctdb/.ctdb.lock" CTDB_MANAGES_SAMBA=yes CTDB_MANAGES_WINBIND=yes
The meaning of these parameters is as follows.
CTDB_NODES
- Specifies the location of the file which contains the cluster node list.The
/etc/ctdb/nodes
file thatCTDB_NODES
references simply lists the IP addresses of the cluster nodes, as in the following example:192.168.1.151 192.168.1.152 192.168.1.153
In this example, there is only one interface/IP on each node that is used for both cluster/CTDB communication and serving clients. However, it is highly recommended that each cluster node have two network interfaces so that one set of interfaces can be dedicated to cluster/CTDB communication and another set of interfaces can be dedicated to public client access. Use the appropriate IP addresses of the cluster network here and make sure the hostnames/IP addresses used in thecluster.conf
file are the same. Similarly, use the appropriate interfaces of the public network for client access in thepublic_addresses
file.It is critical that the/etc/ctdb/nodes
file is identical on all nodes because the ordering is important and CTDB will fail if it finds different information on different nodes. CTDB_PUBLIC_ADDRESSES
- Specifies the location of the file that lists the IP addresses that can be used to access the Samba shares exported by this cluster. These are the IP addresses that you should configure in DNS for the name of the clustered Samba server and are the addresses that CIFS clients will connect to. Configure the name of the clustered Samba server as one DNS type A record with multiple IP addresses and let round-robin DNS distribute the clients across the nodes of the cluster.For this example, we have configured a round-robin DNS entry
csmb-server
with all the addresses listed in the/etc/ctdb/public_addresses
file. DNS will distribute the clients that use this entry across the cluster in a round-robin fashion.The contents of the/etc/ctdb/public_addresses
file on each node are as follows:192.168.1.201/0 eth0 192.168.1.202/0 eth0 192.168.1.203/0 eth0
This example uses three addresses that are currently unused on the network. In your own configuration, choose addresses that can be accessed by the intended clients.Alternately, this example shows the contents of the/etc/ctdb/public_addresses
files in a cluster in which there are three nodes but a total of four public addresses. In this example, IP address 198.162.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 is available. Only if both nodes 0 and 1 fail does this public address become unavailable to clients. All other public addresses can only be served by one single node respectively and will therefore only be available if the respective node is also available.The/etc/ctdb/public_addresses
file on node 0 includes the following contents:198.162.1.1/24 eth0 198.162.2.1/24 eth1
The/etc/ctdb/public_addresses
file on node 1 includes the following contents:198.162.2.1/24 eth1 198.162.3.1/24 eth2
The/etc/ctdb/public_addresses
file on node 2 includes the following contents:198.162.3.2/24 eth2
CTDB_RECOVERY_LOCK
- Specifies a lock file that CTDB uses internally for recovery. This file must reside on shared storage such that all the cluster nodes have access to it. The example in this section uses the GFS2 file system that will be mounted at
/mnt/ctdb
on all nodes. This is different from the GFS2 file system that will host the Samba share that will be exported. This recovery lock file is used to prevent split-brain scenarios. With newer versions of CTDB (1.0.112 and later), specifying this file is optional as long as it is substituted with another split-brain prevention mechanism. CTDB_MANAGES_SAMBA
- When enabling by setting it to
yes
, specifies that CTDB is allowed to start and stop the Samba service as it deems necessary to provide service migration/failover.WhenCTDB_MANAGES_SAMBA
is enabled, you should disable automaticinit
startup of thesmb
andnmb
daemons by executing the following commands:[root@clusmb-01 ~]#
chkconfig snb off
[root@clusmb-01 ~]#chkconfig nmb off
CTDB_MANAGES_WINBIND
- When enabling by setting it to
yes
, specifies that CTDB is allowed to start and stop thewinbind
daemon as required. This should be enabled when you are using CTDB in a Windows domain or in active directory security mode.WhenCTDB_MANAGES_WINBIND
is enabled, you should disable automaticinit
startup of thewinbind
daemon by executing the following command:[root@clusmb-01 ~]#
chkconfig windinbd off