NYCPHP Meetup

NYPHP.org

[nycphp-talk] Seeking recommendations for resources on LAMP be st practices

DeWitt, Michael mjdewitt at alexcommgrp.com
Wed Oct 16 19:58:54 EDT 2002


	Thanks Tim for the insight.  I can see that this is going to take
some re-architecting of my sites.  Perhaps there is a php library around
which does the database abstraction along with checking for redundent
databases in case of primary failure.  I will look around and see what I can
find and post back to the group if anyone is interested.

	Mike

	Tim said:

On Tue, Oct 15, 2002 at 11:17:00AM -0400, DeWitt, Michael wrote:
> 	3. what is the best way to setup and maintain a backup "hot"
> apache/mysql server? 
> 
> 	Can this be practically done with standard linux installs and the
> capabilites of the OS and server daemons?

The way I do this is first, get two web servers running, configured
identical. Keeping them that way can be a chore, but that's another
question.
Use rsync between them to keep your content current. One hole this leaves
is log files, which, to e-commerce sites, may be more important than
content, so I'd look at mysql logging from apache, os that ilk. Mysql
is simple. You can set up 2 replicated servers, but the best way
is to have 3 servers, with the master being where all the writes are
going, and replicated to the slaves, where the reads are done. Now, in
your database code, when you try to attach to your primary slave server,
if that fails, simply try to attach to your 'hot spare' server.

I know this is Perl and LDAP, but it will work the same way in PHP/Mysql.
I just happen to have this code open in my editor:

$ldap=Net::LDAP->new('ldapA.bnl.gov') or
$ldap=Net::LDAP->new('ldapB.bnl.gov') or
$ldap=Net::LDAP->new('ldapC.bnl.gov') or die "$@";

This way, one call should almost always yield a database connection.

Tim

-- 
Tim Sailer <sailer at bnl.gov> 
Application Services
Information Technology Division
Brookhaven National Laboratory  (631) 344-3001


	--- Unsubscribe at http://nyphp.org/list ---




More information about the talk mailing list