7.5. Configuring Automated IP Failover for NFS and SMB

download PDF
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.


  • 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


  • 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.
  1. 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
    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
  2. In the following files, replace all in the statement META=all to the newly created volume name
    For example:
  3. Start the volume.
    The 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.


    When you stop a volume, 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.
  4. 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.
  5. 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.
    The IPs listed here are the private IPs of Samba servers.
  6. 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: eth0 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.
  1. Run # service ctdb start to start the CTDB service.
  2. Run # chkconfig smb off to prevent CTDB starting Samba automatically when the server is restarted.
  3. Verify that CTDB is running using the following commands:
    # ctdb status
    # ctdb ip
    # ctdb ping -n all
  4. Mount a Red Hat Storage volume using any one of the VIPs.
  5. Run # ctdb ip to locate the physical server serving the VIP.
  6. 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.
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.