cluster-computinghigh-availabilitypacemakerdrbd

DRBD with temprorary hostname change


I have set-up a test 2-node HA cluster for an application which writes data to local disk. DRBD has been set up for this to sync the data onto the 2nd node. My application is having dependency on the hostname to start/stop and perform any task. To have it highly available, I have set up Cluster IP and temporarily renaming my node from its actual name to the name of the virtual IP.

All this works fine with manually promoting DRBD resource to primary and mounting it on any node where the virtual IP is set at any moment.

As soon as I try to add DRBD resource in pacemaker and then to start my application with the temporary name (hostname change using hostname command, example:- nodeA:~# hostname test-ip), The HA cluster fails for DRBD and umounts from the server promoted to primary earlier. Thus I am unable to get my application fully managed by the cluster.

Is there anyway in which DRBD can work with the virtual IP's hostname (renaming a host) in a 2-node cluster?


Solution

  • You can configure DRBD to associate with an IP address instead of a hostname via the "floating peers" feature. For example:

    resource r0 {
        device /dev/drbd0;
        protocol C;
    
        floating 192.168.40.125:7789 {  
            disk /dev/sdb;
            meta-disk internal;
        }
    
        floating 192.168.40.126:7789 {  
            disk /dev/sdb;
            meta-disk internal;
        }           
    }
    

    This was designed for using multiple DRBD host attached to the same shared storage, but it should still work for your use case and local storage.