简体   繁体   中英

How SailsJS connects to mysql with replication failover?

I have developed an application using SailsJS, using sails-mysql adapter. I want to setup replication and automatic failover for MySQL. In a typical java application using JConnector, I would have specify the master and slave configuration on my connection string. What about SailsJS?

After a few days of digging around the net. I have found the solution to use HAProxy to load balance MySQL nodes. My sails-mysql adapter will only connect to HAProxy address. There is an awesome tutorial here to setup HAProxy with MySQL.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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