-1

I am working in a project where we are using Go as a web server and MySQL. We have been told to implement fault tolerance to handle a hardware crash. We were given 2 servers which have MySQL and the Go-server on them.

We have succesfully set up replication in MySQL, but we are struggling with the failover part. Our thought was to get an extra server with HAProxy to have a primary server and then being able to failover to the backup server. We also considered using MySQL failover, but did not see how we could redirect the traffic using it.

Is this a reasonable plan? Or what would you recommend that we do instead?

Zoyd
  • 3,449
  • 1
  • 18
  • 27
  • please post all details about your MySQL cluster setup (config files and what you did). This "set up replication in MySQL, but we are struggling with the failover part" not good. `HAProxy` is recommended for load balancing and failover, but you need anyway a working MySQL setup. – Sybil Mar 22 '17 at 10:28

1 Answers1

0

If you want two identical servers connecting to their local MySQL instances, you need a way of deciding which one is the production server. There are a number of solutions for that, including

  • Setting up a reverse proxy, as you mention, but then, your proxy itself becomes a SPOF,
  • Using a floating IP, also known as a failover IP, but this only works if your host supports it. Cloud providers typically support them, as well as some bare metal server providers.

There is nothing specific to Go as far as I know.

Zoyd
  • 3,449
  • 1
  • 18
  • 27
  • I ended up using HAProxy running on a single server to decide which database to send requests to. It is still a SPOF, but it should be more stable and it was also hosted in the cloud. By using HAProxy we were able to direct some traffic that can accept some stale data, to read from the secondary database. – Hellenberg Mar 26 '19 at 08:31