# HA clustering on FreeBSD



## takeda (Jun 6, 2014)

Hi,

I'm looking for a failover solution that monitors health and allows me to call an external script.
I basically want something that regularly monitors state of the master and if it sees that master is down it will take over.

I have hard time to find such solution for FreeBSD.


----------



## wblock@ (Jun 6, 2014)

Have you looked at HAST and CARP?


----------



## takeda (Jun 6, 2014)

Yest I did.

The HAST has no use for me here (this is to implement HA for MooseFS master, so no need to share disks), as for CARP the nodes would be in different subnets, and I don't (and can't) set them up to share virtual IP (though switching them through DNS appears to work fine).

Unless I misunderstand something CARP won't work in my scenario.

uCARP could possibly work, but I can't use multicast (it is in AWS which apparently they don't support it), unless there's a way to make it work over unicast.

Are there any other solutions?


----------



## storvi_net (Jun 7, 2014)

I think you misunderstood CARP. 
CARP is the way to use one virtual IP, which can be switched from a master to a slave.

Regards
Markus


----------



## ondra_knezour (Jun 7, 2014)

It depends what you mean as "take over". Start some services? Maybe some simple script like the following pseudocode for the http service may be enough?

```
while true {
   fetch http://otherserver/ || service onestart myservice
   sleep(1000)
}
```

I would also investigate, if carp(4) may be used over the IP tunnel like gif(4) or any other VPN solution. Then you can use the devd(8) notification to do your take over, for example start some services, change DNS settings, propagate something via BGP etc.


----------



## takeda (Jun 11, 2014)

storvi_net said:
			
		

> I think you misunderstood CARP.
> CARP is the way to use one virtual IP, which can be switched from a master to a slave.



Markus, unfortunately in my case CARP won't work. The availability zones in AWS are almost (and I'm actually certain it is implemented this way) different data centers in the same region. So nodes in two different AZs will have two different subnets, so there is no easy way to share an IP. uCARP appears to be able to work with this limitation, but it requires routable multicast which is another thing that AWS does not provide.
To perform failover I'm planning to use DNS, it looks like MFS is fine with it.



			
				ondra_knezour said:
			
		

> It depends what you mean as "take over". Start some services? Maybe some simple script like the following pseudocode for the http service may be enough?
> 
> ```
> while true {
> ...



I'll try to make heartbeat port work, and if I fail there then either implement my own solution (I'm thinking of election on zookeeper cluster).

BTW did anyone was successful in making corosync work on FreeBSD?


----------



## Paul-LKW (Jun 25, 2014)

Heartbeat will work only with limited basic function, when you set it with resource control you will see it is useless.


----------



## vermaden (Jun 25, 2014)

@takeda,

Your only solutions are HAST with uCARP/CARP and/or limited Heartbeat.

There is no 'cluster software' (like PowerHA/Veritas/Serviceguard/...) for FreeBSD.


----------



## bsdnet (Feb 27, 2015)

takeda said:


> BTW did anyone was successful in making corosync work on FreeBSD?



I also want to know this.  `corosync` claims it can run on FreeBSD.


----------



## vermaden (Mar 2, 2015)

bsdnet said:


> I also want to know this.  `corosync` claims it can run on FreeBSD.


Last time I tried `corosync` it used about 100+ MB for each node (at Linux), can not recommend it.


----------



## bsdnet (Mar 24, 2015)

vermaden said:


> Last time I tried `corosync` it used about 100+ MB for each node (at Linux), can not recommend it.



Thanks,  this is a really memory sucker.
I still cherish the time we use memory byte by byte.
As I know, a lot of clusters used in enterprise applications are using zookeeper now.


----------

