7.5. Configuring Automated IP Failover for NFS and SMB
In a replicated volume environment, Cluster Trivial Database (CTDB) can be configured to provide high availability for NFS and SMB exports. CTDB adds virtual IP addresses (VIPs) and a heartbeat service to Red Hat Storage Server.
When a node in the trusted storage pool fails, CTDB enables a different node to take over the IP address of the failed node. This ensures the IP addresses for the services provided are always available.
Note
- Amazon Elastic Compute Cloud (EC2) does not support VIPs and hence not compatible with this solution.
7.5.1. Setting Up CTDB
Configuring CTDB on Red Hat Storage Server
Note
- If you already have an older version of CTDB, then remove CTDB by executing the following command:
# yum remove ctdb
After removing the older version, proceed with installing the latest CTDB. - Install CTDB on all the nodes that are used as Samba servers to the latest version using the following command:
# yum install ctdb2.5
- In a CTDB based high availability environment of NFS and SMB, the locks will not be migrated on failover.
- You must ensure to open Port 4379 between the Red Hat Storage servers.
- Create a replicate volume. This volume will host only a zero byte lock file, hence choose minimal sized bricks. To create a replicate volume run the following command:
# gluster volume create volname replica n ipaddress:/brick path.......N times
where,N: The number of nodes that are used as Samba servers. Each node must host one brick.For example:# gluster volume create ctdb replica 4 10.16.157.75:/rhs/brick1/ctdb/b1 10.16.157.78:/rhs/brick1/ctdb/b2 10.16.157.81:/rhs/brick1/ctdb/b3 10.16.157.84:/rhs/brick1/ctdb/b4
- In the following files, replace all in the statement META=all to the newly created volume name
/var/lib/glusterd/hooks/1/start/post/S29CTDBsetup.sh /var/lib/glusterd/hooks/1/stop/pre/S29CTDB-teardown.sh.
For example:META=all to META=ctdb
- Start the volume.The
S29CTDBsetup.sh
script runs on all Red Hat Storage servers and adds the following lines to the[global]
section of your Samba configuration file at/etc/samba/smb.conf
.clustering = yes idmap backend = tdb2
The script stops Samba server, modifies Samba configuration, adds an entry in/etc/fstab/
for the mount, and mounts the volume at/gluster/lock
on all the nodes with Samba server. It also enables automatic start of CTDB service on reboot.Note
When you stop a volume,S29CTDB-teardown.sh
script runs on all Red Hat Storage servers and removes the following lines from[global]
section of your Samba configuration file at/etc/samba/smb.conf.
clustering = yes idmap backend = tdb2
It also removes an entry in/etc/fstab/
for the mount and unmount the volume at/gluster/lock
. - Verify if the file
/etc/sysconfig/ctdb
exists on all the nodes that is used as Samba server. This file contains Red Hat Storage recommended CTDB configurations. - Create
/etc/ctdb/nodes
file on all the nodes that is used as Samba servers and add the IPs of these nodes to the file.10.16.157.0 10.16.157.3 10.16.157.6 10.16.157.9
The IPs listed here are the private IPs of Samba servers. - On all the nodes that are used as Samba server which require IP failover, create
/etc/ctdb/public_addresses
file and add the virtual IPs that CTDB should create to this file. Add these IP address in the following format:<Virtual IP>/<routing prefix><node interface>
For example:192.168.1.20/24 eth0 192.168.1.21/24 eth0
7.5.2. Starting and Verifying your Configuration
Perform the following to start and verify your configuration:
Start CTDB and Verify the Configuration
Start the CTDB service and verify the virtual IP (VIP) addresses of a shut down server are carried over to another server in the replicated volume.
- Run
# service ctdb start
to start the CTDB service. - Run
# chkconfig smb off
to prevent CTDB starting Samba automatically when the server is restarted. - Verify that CTDB is running using the following commands:
# ctdb status # ctdb ip # ctdb ping -n all
- Mount a Red Hat Storage volume using any one of the VIPs.
- Run
# ctdb ip
to locate the physical server serving the VIP. - Shut down the CTDB VIP server to verify successful configuration.When the Red Hat Storage Server serving the VIP is shut down there will be a pause for a few seconds, then I/O will resume.