This is a really dumb question, but here goes.
- I've got one web server, running a simple PHP app.
- I've got two MySQL servers, with one replicated database, which powers the PHP app. I'm using two MySQL databases to deal with demand.
How can I (and indeed, can I) get the PHP app to alternate which MySQL server it uses?
The PHP line where I connect to the database is currently this:
$con = mysql_connect('10.0.0.2:3306','name','password')
or die('Could not connect to the server!');
Is there a way I can load-balance with 10.0.0.2 and my other server? Thanks.