duanjiao4763 2017-03-22 09:00
浏览 76
已采纳

使用Go和MySQL设置具有容错能力的服务器(故障转移)

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?

  • 写回答

1条回答 默认 最新

  • dsdf64562672 2017-03-22 11:08
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效