简体   繁体   English

SailsJS如何通过复制故障转移连接到mysql?

[英]How SailsJS connects to mysql with replication failover?

I have developed an application using SailsJS, using sails-mysql adapter. 我使用sails-mysql适配器开发了一个使用SailsJS的应用程序。 I want to setup replication and automatic failover for MySQL. 我想为MySQL设置复制和自动故障转移。 In a typical java application using JConnector, I would have specify the master and slave configuration on my connection string. 在使用JConnector的典型Java应用程序中,我将在连接字符串上指定主从配置。 What about SailsJS? SailsJS怎么样?

After a few days of digging around the net. 经过几天的网络挖掘。 I have found the solution to use HAProxy to load balance MySQL nodes. 我找到了使用HAProxy来平衡MySQL节点的解决方案。 My sails-mysql adapter will only connect to HAProxy address. 我的sails-mysql适配器只能连接到HAProxy地址。 There is an awesome tutorial here to setup HAProxy with MySQL. 这里有一个很棒的教程,用MySQL设置HAProxy。

https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM