RE: [PHP] mysql replication + mysql_pconnect
| From: | Dan Rossi | Date: | Sun, 02 Mar 2003 08:29:16 +0000 |
| Subject: | RE: [PHP] mysql replication + mysql_pconnect | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137768@lists.php.net to get a copy of this message | ||
i'll explain
i need a fallbak method where if the master server is down it will goto the
slave i assumed the connection could do this automatically but it doesnt
therefore requires it setup in the php connection script ,
part of my db class $this->connection = @mysql_pconnect($host,$user,$pass);
say host is localhost:3308 it will still connect to the master on 3306 , or
even localhost:3307 which is the slave it will still get the master server ,
i turn off the master server and i get this localhost:3307Can't connect to
local MySQL server through socket
'/usr/local/etc/mysqlmaster/tmp/mysql.sock' (2) where 3307 is the slave ,
one thing though , i have this in my php configure
'--with-mysql=/usr/local/etc/mysqlmaster' ' is that a problem ?
-----Original Message-----
From: Rich Gray [mailto:rich@f1central.net]
Sent: Sunday, March 02, 2003 12:34 PM
To: electroteque; php-general@lists.php.net
Subject: RE: [PHP] mysql replication + mysql_pconnect
> hi there i am setting up a test replication slave server as a mysql db
> master backup if it fails , i would like to know how to
> dynamically connect
> to the slave if the master fails , something really strange i have set the
> host like localhost:3307 for the slave but is still connecting to
> the master
> , and if i shut down the master it wont goto the slave :|
>
>
Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the
master
server? Can you describe the problem in more detail?
Rich