Skip to content

Instantly share code, notes, and snippets.

@webmaster128
Last active March 28, 2018 22:30
Show Gist options
  • Save webmaster128/8ac45785c03be0d21711c1dd872bf4c9 to your computer and use it in GitHub Desktop.
Save webmaster128/8ac45785c03be0d21711c1dd872bf4c9 to your computer and use it in GitHub Desktop.

Rename network interface to eth0

If you can, you make your live easier by renaming the network interface (first cable network) to eth0. See https://askubuntu.com/a/801310

Install and configure heartbeat (all nodes)

$ sudo apt-get install -y heartbeat
$ sudo touch /etc/ha.d/authkeys
$ sudo chmod 600 /etc/ha.d/authkeys

Edit /etc/ha.d/authkeys using a custom password (e.g from cat /dev/urandom | head -c 256 | sha1sum | cut -d' ' -f1)

auth1
1 sha1 1c441077edc8069ff9a09ed9ee1cbab20469d1ec

Collect node information

On every node collect

  • node name (e.g. "my-hostname1"),
  • interface name (e.g. "enp0s3") and
  • ip address (e.g. "192.168.178.111")

using the commands

$ uname -n
my-hostname1
$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.111  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 aaaa::bbbb:cccc:dddd:eeee  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:b8:51:7c  txqueuelen 1000  (Ethernet)
        RX packets 871002  bytes 198840987 (198.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1068552  bytes 171399127 (171.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 132092  bytes 91557087 (91.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 132092  bytes 91557087 (91.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Edit /etc/ha.d/ha.cf on both nodes (same content except the interface name), e.g.:

auto_failback on

node my-hostname1
ucast enp0s3 192.168.178.111
node my-hostname2
ucast enp0s3 192.168.178.105

and

auto_failback on

node my-hostname1
ucast ens1 192.168.178.111
node my-hostname2
ucast ens1 192.168.178.105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment