I hired 46 VPS and today only one have with database, and another one like to slave(replica).
How i can connect to this two(or more) server for manage the same database?
For example: server #1 is down, so connect to server #2 or #3, #4, #5...
Right now i know it:
$connection=Mysqli_connect(...);
Maybe exists another method like to:
$connection=mysqli_connect_mutiserver(array(...));
I think un a loop to check ping and time response, and if some fail, this return the next good connection.
For(...){
if(ping(...) and timing(...)){
return $serverInfo;
}
}
P.s: i'm sorry, right now i used my smartphone to post it(maybe dont show the code like to prettyprint.