DRBD - 'node1' not defined in your config (for this host) - Error when setting Primary

9,520

You're not using the drbdadm command correctly. It wants the resource name, where you're giving it a node name.

Try this instead (from node1):
# drbdadm up clusterdb
# drbdadm primary --force clusterdb

As a side note, DRBD expects the hostnames in its config to be the same as uname - n.

Share:
9,520

Related videos on Youtube

FreeSoftwareServers
Author by

FreeSoftwareServers

Updated on September 18, 2022

Comments

  • FreeSoftwareServers
    FreeSoftwareServers almost 2 years

    I am getting the following error when trying to set the Primary node for DRBD.

    'node1' not defined in your config (for this host).
    

    I know this is related to DNS/Hostname/Hosts and the config clusterdb.res. I know this because I originally got an error when trying to start clusterdb.res if node1 didn't resolve correctly. So what confuses me is that I can start the clusterdb.res if either use:

    I have used this command on the hosts

    hostnamectl set-hostname $(uname -n | sed s/\\..*//)
    

    To make the hostname resolve to node1 instead of node1.localdomain

    Or add node1.localdomain to the config, either works. But I have tried all combinations and can't seem to get this command to take :

    drbdadm primary --force node1 && cat /proc/drbd
    

    My Configs

    /etc/drbd.d/clusterdb.res

    resource clusterdb{
        protocol C;
        meta-disk internal;
        device /dev/drbd0;
    
    startup {
        wfc-timeout 30;
        outdated-wfc-timeout 20;
        degr-wfc-timeout 30;
    }
    
    net {
        cram-hmac-alg sha1;
        shared-secret sync_disk;
    }
    
    
    syncer {
        rate 10M;
        al-extents 257;
        on-no-data-accessible io-error;
        verify-alg sha1;
    }
    on node1 {
        disk /dev/sda3;
        address 192.168.1.216:7788;
    }
    on node2 {
        disk /dev/sda3;
        address 192.168.1.217:7788;
    }
    }
    

    /etc/hosts :

    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.1.216 node1
    192.168.1.217 node2
    

    /etc/hostname

    node#
    

    My full write up ATM (wip)

    Edits :

     [root@node1 ~]# hostname
     node1
     [root@node1 ~]# cat /etc/hosts
     127.0.0.1   localhost localhost.localdomain localhost4      localhost4.localdomain4
     ::1         localhost localhost.localdomain localhost6      localhost6.localdomain6
     127.0.1.1     node1
     192.168.1.216 node1
     192.168.1.217 node2
     [root@node1 ~]#
    

    Update: I have gotten this to work with LVM following this guide exactly, so I think my issue actually lies with the following lines of code. But for now I think i will stick with LVM since it works, unless somebody else really wants to work on this. (My working LVM writeup)

    device /dev/drbd0;
    

    or

     device /dev/drbd0; 
    

    The reason I say this, is I used the same hosts/hostname/shortname/ip_addr but LVM and it worked, but maybe I missed something the first time, I fixed in my new VM Template (I started from scratch to build LVM)

    • geruetzel
      geruetzel about 8 years
      Just to be sure - can you please add the output of hostname? Also please add the following line to your /etc/hosts: 127.0.1.1 node1
  • FreeSoftwareServers
    FreeSoftwareServers about 8 years
    As soon as I read your answer I understood. Durp thanks!