Skip to content

Using MySQL Load Balancer

aatishnn edited this page Nov 12, 2011 · 1 revision

This is not completed yet however the concepts of primary and backup servers are implemented.

Defining Variables:

Replace lines:
public $server_main=array("127.0.0.1:3306","root","","maindb");
public $backup_server=array("127.0.0.2:3309","root","","backupdb");
with the server configuration.

Create a new object:

require("balancer.inc.php");
$details = new loadbalancer();

Get server details:

$server=$details->returnconfig();

Use details in your application:

$hostname=$server[0];
$username=$server[1];
$password=$server[2];
$database=$server[3];

Clone this wiki locally