Failover and Fault Tolerant!

I was having some challenges with a zwave.me stick and so switched to using usbip. This is a linux only solution though (the windows client is not so great and quite old), but if you are using linux, could work well. Mine has been in use for a few months now without any issues.

Iā€™m having problems with monit, as it just monitors openhab, but is not able to restart it. monit runs as root and should be able to restart any service, but openhab fails. Could you please share your openhab monit config?
BTW: A manual start of openhab works fine.
Do you start openhab via systemd or sysVinit scripts?

Hi,

I can gladly share my monit config, but it might not help you much. Iā€™m not using either systemd or sysvinit as I run it in a screen. I like to be able to log in on the server in question (H/A pair) and see what itā€™s actually doing. Iā€™m fully aware of the logs, but itā€™s something that stuck from getting started with it way back when. The config is slightly more extensive, but this is the beef of the matter:

/etc/monit/conf.d/openhab:

check process openhab-jvm
   matching "java"
   start program = "/mnt/openhab/etc/openhab-monit-start.sh"
   stop program = "/mnt/openhab/etc/openhab-monit-stop.sh"
   if cpu usage > 10% for 5 cycles then restart

[ā€¦more conditionsā€¦]

My start.sh is also customized to check for example whether the node has the shared IP and if any locks are present.

/mnt/openhab/etc/openhab-monit-start.sh:

#!/bin/sh
/usr/bin/screen -t "OpenHAB" -dmS openhab /mnt/openhab/start.sh

/mnt/openhab/etc/openhab-monit-stop.sh:

#!/bin/sh
/usr/bin/pkill java;
/bin/sleep 15;
/usr/bin/pkill -9 java;

Again, there are some environmental specifics, but this is the logic.

Oh yeah, @crankycoder: You might want to take a look at DRBD9, itā€™s more like a fully featured SAN over Ethernet instead of just RAID1 with pitfalls. When I come around to rebuild the setup I might just drop OCFS2/O2CB. Stateful resource management with Corosync/Pacemaker might also be an option if you simply want primary/secondary DRBD with role switching on the fly.

Cheers,

PelliX

1 Like

Thanks Pelli, Ill take a look. My DRBD8 has been acting up and not syncing. Ill try it with 9. I need to start my lab environment soon for 2.0!

@pelnet Great! This seems to work quite well with Monit on MacOS!

Many thanks.