I have a question about database connection in Magento I would like to use a primary database to read and write data and if this database will have a problem and goes offline, I would like to use another database to read and write data. Is possibile to configure two database in local.xml?


It is not possible to configure Magento to check a second server when the first server fails. The only configuration that is possible thru the local.xml configuration is specifying a read/write (master) and read-only (slave) connection.

To have Magento write to a backup database you will need to configure a database cluster with multiple masters and assign a floating IP or load-balancing solution that uses a single IP address. The load-balancer then directs the requests to one of the MySQL servers, in case a server fails the load-balancer disables this server and only directs traffic to the other available servers.

See http://severalnines.com/mysql-load-balancing-haproxy-tutorial for details on how to configure HA-Proxy as a load-balancer for MySQL.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.