MySQL/PHP with redundant slave servers 
Author Message
 MySQL/PHP with redundant slave servers

I have a bunch of web servers that depend on mysql DB to
provide data to dynamically generated web pages.

For MySQL, I have one master and two slaves.

The link to the DB is via php. I want the slave servers to act also
redundant servers for providing data to my php code.

I tried the following

$db = mysql_connect(server1,user,pass) or mysql_connect(server2,user,pass)

but, if fails to go with to server2 if server1 is down, Is there any thing
that I am doing wrong ?

Anand



Tue, 18 Oct 2005 08:46:29 GMT  
 MySQL/PHP with redundant slave servers
Anand,

Try this:

$ db = mysql_connect(server1,user,passwd);
if (!$db) { $db = mysql_connect(server2,user2,passwd2); }

V/r,
Charles


Quote:
> I have a bunch of web servers that depend on mysql DB to
> provide data to dynamically generated web pages.

> For MySQL, I have one master and two slaves.

> The link to the DB is via php. I want the slave servers to act also
> redundant servers for providing data to my php code.

> I tried the following

> $db = mysql_connect(server1,user,pass) or mysql_connect(server2,user,pass)

> but, if fails to go with to server2 if server1 is down, Is there any thing
> that I am doing wrong ?

> Anand



Tue, 18 Oct 2005 09:08:46 GMT  
 MySQL/PHP with redundant slave servers
Thank you Charles


to suppress the warning that gets on the page from the failed server

Anand



Tue, 18 Oct 2005 17:53:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using remote MySQL server with PHP via HTTP

2. PHP can't connect to MySQL server

3. PHP, MYSQL, IIS5 and Win2k Server in a Corporate Environment

4. SQL Server to MySQL thru PHP

5. php mysql sample code php shareware like KB knowledgebase

6. PHP+MySQL vs. PHP+PostgreSQL

7. php + mysql or php + postgresql?

8. MySQL locally vs. MySQL on server

9. Master and Slave - slave alias procs act in master

10. Access Denied error using mySQL through PHP

11. PHP mysql_close(): supplied argument is not a valid MySQL-Link resource

 

 
Powered by phpBB® Forum Software