HAST questions

Chris Gordon freebsd at theory14.net
Wed Jan 17 00:32:12 UTC 2018

> On Jan 12, 2018, at 1:10 AM, Zainelabdeen S.A Elgraeed <zainco30 at gmail.com> wrote:
> > It really depends on the details of the application on what options you have and what the best way to do this may be.
> we host dynamic content with MySQL databases like Moodle and OJS.
> I want for storage to be active/active but HAST is master/backup so I can be used for failover only.
> is HAST support DRBD ? or what another technology can use for HA and LB for storage?

The exact solution can be somewhat dependent on your specific environment, but I’d start looking at:

- Run the web servers (apache, nginx, whatever) active in both/all jails and distribute traffic to them with some kind of load balancer (commercial appliance, other machines running ha-proxy or the like).
- Run one master DB and one standby DB with database replication replicating content between the two.  Most RDBMs support some kind of replication including MySQL.
- With MySQL you can do reads from both the active and standby nodes, but write to only the master.  It depends on your particular application if/how you can configure the application to take advantage of the slave reads.
- In the event of the failure of one of the hosts, you only need to worry about switching the roles of the DB and potentially re-pointing the applications if the primary DB node is the one that goes away.
- I would consider putting the database servers and web servers in different jails.  This lets you scale them, add resource controls if appropriate, move them, etc independently.

I prefer database/application replication over storage replication in most use cases since storage replication will often dutifully replication file system and other problems for you.  Database replication typically gives you some additional independence between your nodes and reduces certain chances of fault replication.  Regardless of which you choose, you need to make sure you exercise and understand the many failure cases you can end up in and know how to recover the system.  Also remember that replication like this is NOT a backup -- be sure to also have a good back (and recovery) plan.

Active/Active is another can of worms.  Active/Active storage for writes is a very difficult problem.  Even if someone said they have it, I’d be very careful with all of the corner cases and failure modes.  Active/Active databases do exist (MySQL has Galera, I believe Postgres has a paxos based solution), but again you get a lot of additional complexity and need to really understand and test the solution before using it.

Hope that helps.


More information about the freebsd-questions mailing list