help for /etc/hosts file in a HA cluster with DRBD9

Kei

Well-Known Member
May 29, 2016
88
2
48
38
Hello,
I am a little confused when it comes to implement a separate network for DRBD9, because I'm supposed to have a resolution in my hosts file for both corosync (PVE cluster) and also for DRBD. So I'm not sure how am I supposed to setup my hosts file. Anyone with an HA cluster + DRBD9 can share their file? Thank you!
 
You have to put two lines in the hosts files for every hostname; one beginning with the ip for the storage network, one with the ip of the ordinary network.
That's it.

bye,
rob
 
Sorry the dumb question, but how is the system supposed to know when it should resolve the hostname as IP of management or IP of the DRBD network?
 
Maybe I wrongly assume that you need to have the same hostname for both MGMT and DRBD addresses?
 
Sorry the dumb question, but how is the system supposed to know when it should resolve the hostname as IP of management or IP of the DRBD network?

Not a dumb question at all. You do not need hostname -> ip resolution for configuring drbd9, you provide IP of the nodes (
drbdmanage add-node -q <node-name> <ip>) . Personally i put storage network IPs in /etc/hosts only to enable reverse lookup for ssh.
 
Sorry if I bother again. I was confused by the fact that, when you are almost done typing "drbdmanage add-node <node name>" and you are about to type the first characters of the IP address, you find out that you can press TAB and it will autocomplete, using the hosts file resolution. But accordingly to what I understand from you, I could write anything instead of "hostname" and it would work anyways. Is this correct?
 
From "man drbdmanage-add-node":
Nodename must match the name that is used as the node name of
the drbdmanage server on the new participating node. Commonly, nodename
is set to match the output of "uname -n" on the new participating node.
rob