I need to setup the IP of a cluster of applications servers to connect to a cluster of database servers. For 1 to 1, application server to database server is quite easy, but when comes to a cluster environment, I wonder how should I configure/setup the IP in application servers to connect to more than one database servers, especially in a active/passive setup. I am confuse as I am not sure how should I setup the IP where the application server know which active database server it should communicate to and when to communicate to another database server when the master database server is down. Can somebody guide me towards a direction I should go?
These are the configuration for the cluster/HA setup:
- I have a layer 2 switch that is connected to the datacenter's router.
- I have 2 application servers and 2 database servers.
- Both application servers and database servers are in their own cluster using Debian OS with Corosync, Pacemaker and DRBD setup.
- Both the application servers and database servers cluster are connected directly to the switch.
- In between the application/database server, I used a dedicated NIC for the corosync to monitor the heartbeat.
- Application running on my application server are just APIs coded using code igniter.
- My database contain postgesSQL and MongoDB.