One year ago I started my home automation project. It then consisted of
a large (Windows) server and php web interface hosted externally.
Changes where made on the web interface which would be polled by the server.
If the server found a change in state for example a light bulb, it would execute a command. In this case turn on the light bulb over X10.
Running a full server (with its power cost) for something this simple is overkill. And since I’m trying to get a grip on my power usage, it seems a good idea to reduce the computing power, and power cost.
Why a cluster..?
I have been messing around with Raspberry’s before, and something that really bothered me was the lack of stability. For example. I had made a RPI based thermostat complete with LCD and PIR motion sensor. After I wrote the code I tested the setup for a week before installing it. Within this week the RPI crashed a few times, got harder to boot, and finally did not boot at al. After doing some research it seemed that some files where corrupted on the SD card. Reading the stories on internet, I’m not the only one with corrupted SD cards. Anyhow, I love the simplicity and power of the Raspberry, and still want to give it a fair chance at being stable. I thought I would help it a little by making a 3 node H.A. cluster with a decent power supply.
Is it working…?
At this moment in time I really don’t know, but I sure hope it does. I’m currently testing the cluster, and want to thank you for doing to! The link to the cluster status is running on the cluster, and there you can see the current state of the nodes. Green nodes are up and running, and red nodes are offline.
How does it work?
Really simple. The nodes all have two IP’s, one node IP, and one
master IP that is offline (eth0:0 << alias). The nodes run some
bash script for synchronising the Mysql and web directory, and a
heartbeat script. If the heartbeat script detects that the master is
down, it will bring up a other node (clone) of the master.
It’s as simple as that. : )