VirtualBox: How to Add Serial Port for Linux Cluster Heartbeat Monitoring

root's picture

For that you will have to stop the machines one by one and configure in VirtualBox the serial port. In this example we will use a virtual serial port configured trough a pipe on the host machine.

Candy (node 1) VirtualBox Serial Port Configuration:

Enable Serial Port check box: checked (enabled)
Port Number: COM1
Port Mode: Host Pipe
Create Pipe check box: checked (enabled)
Port/File Path: /tmp/vboxDONOTDELETES0

The moment you start candy, you should see the pipe file in core (host machine) created:

core:~# ls -la /tmp/vboxDONOTDELETES0
srwxr-xr-x 1 vbox vbox 0 Dec  5 15:58 /tmp/vboxDONOTDELETES0

Eave (node 2) VirtualBox Serial Port Configuration:

Enable Serial Port check box: checked (enabled)
Port Number: COM1
Port Mode: Host Pipe
Create Pipe checking box: unchecked (disabled)
Port/File Path: /tmp/vboxDONOTDELETES0

If you try to start the first machine with an unchecked "Create Pipe" check box then you will get one error message and the machine will not start.
Also, when you reboot the host, make sure you start candy before eave, for the same reason.

Now that we have both machines up and running with serial ports configured, we can start testing and configuring our cluster.

Test serial connection:

On candy:

cat < /dev/ttyS0

On eave:

echo "Serial Connection test" > /dev/ttyS0
You should see the text on the receiver node (ha1). If it works, change their roles and try again.

Example:

root@eave:~# echo "Serial Connection test" > /dev/ttyS0
root@eave:~# echo "Serial Connection test 2" > /dev/ttyS0
root@eave:~# echo "Serial Connection test 3" > /dev/ttyS0
root@candy:~# cat < /dev/ttyS0
Serial Connection test

Serial Connection test 2

Serial Connection test 3

Add on both nodes in the configuration file /etc/ha.d/ha.cf the following and restart your nodes one by one:

serial /dev/ttyS0

The moment you restart the second node, you should see in the log the following:

Dec 05 16:13:24 candy heartbeat: [3913]: info: Link eave:/dev/ttyS0 up.

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root