08-07-2008
LAMP Server Failover
How does everyone else handle this?
My Setup:
Server A:
CentOS 5.x
10.0.0.1
Apache
MySQL Master
Server B:
CentOS 5.x
10.0.0.2
Apache
MySQL Slave
My Domains:
dom1.com A record: 10.0.0.1
A Record: 10.0.0.2
dom2.com A record: 10.0.0.1
A Record: 10.0.0.2
.
.
.
Since you CANNOT write to the slave, and have master updated, I have heard that 2 way replication will cause problems. I have setup all writes to goto master (write.dom1.com) and reads goto slave (read.dom1.com) via hosts file on each server.
If Server A goes down Server B detects this and rewrited hosts file to (writes.dom1.com) to its self so everything works great.
But if the script on Server B acts to quickly and takes over writes and Server A starts responding now the databases are not consistant anymore.
I guess I could have the script that changes the hosts file to reverse the MASTER and SLAVE computers and reestablish the replication but thats a PITA.
Is there a better way to handle this?
Keep in mind I only have 2 Dual P4 servers. These are just my personal websites and if they go down its not really a big deal but I still would like to know how everyone else would handle this if they were 'somewhat' missioan critical with limited resources.
Thanks...
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi there, I've got a debian 3.1r4 half working (no x yet :P)
I need some pointers for installing a Apache - MySQL - PHP configuration on my box, and set them up to work together. I know to use vim a bit :)
I would like something that is similar to tanguay.at, or even simpler, since I'm a real... (1 Reply)
Discussion started by: izua
1 Replies
2. High Performance Computing
I have just completed a first RTFM of "Veritas Cluster Server Management Console Implementation Guide" 5.1, with a view to assessing it to possibly make our working lives easier.
Unfortunately, at my organisation, getting a test installation would be worse than pulling teeth, so I can't just go... (2 Replies)
Discussion started by: Beast Of Bodmin
2 Replies
3. Web Development
Here is some sample PHP code you can run if you have a PHP web application that uses code or images from an ad server, image server, or content deliver network, and you want to check if it is working and if not, failover to another one:
<?php
$current_server = "server.domain.com";
// set... (0 Replies)
Discussion started by: Neo
0 Replies
4. HP-UX
Hi there!
I'm having problems migrating and vgimport onto a different server. Original server uses the legacy DSF naming (ctd naming like /dev/dsk/c0t1d0) and the new server where i'm migrating those luns to is using the Agile addressing (i.e persistent DSF i.e. /dev/disk/diskxxx)
Importing a... (1 Reply)
Discussion started by: ilan
1 Replies
5. Red Hat
Hi Friends,
I am setting up my new public DNS server using bind 9 on RHEL5.5 64bit.
I also want to have an another DNS failover server on one of my another datacenter. My question is, if i installed an new slave DNS server on the second datacenter and configure the zone transfer, do it will be... (2 Replies)
Discussion started by: arumon
2 Replies
6. Web Development
I'm afraid I'm going to have to migrate our entire website from Linux. There have been a number of irregularities in our MySQL database and the system that we have set up -probably isn't scalable.
Since my manager is re-envisioning (taking the moment to re-engineer) -he wants to move the... (5 Replies)
Discussion started by: Astrocloud
5 Replies
7. Web Development
Hello everyone,
I would like to setup a lamp server from a minimal distro and to compile PHP, MySQL and Apache myself.
I have chosen CentOS minimal for the OS and I am trying to build the stack by hand... But well, it appears I need some help!
First: I am looking for good and recent... (3 Replies)
Discussion started by: freddie50
3 Replies
8. HP-UX
Dear Folks,
How to Install LAMP on HP-UX system. Please Guide.
Regards,
KRISHNA (2 Replies)
Discussion started by: krishna.lu
2 Replies
LEARN ABOUT PHP
mysqlnd_ms_match_wild
MYSQLND_MS_MATCH_WILD(3) 1 MYSQLND_MS_MATCH_WILD(3)
mysqlnd_ms_match_wild - Finds whether a table name matches a wildcard pattern or not
SYNOPSIS
bool mysqlnd_ms_match_wild (string $table_name, string $wildcard)
DESCRIPTION
Finds whether a table name matches a wildcard pattern or not.
This function is not of much practical relevance with PECL mysqlnd_ms 1.1.0 because the plugin does not support MySQL replication table
filtering yet.
PARAMETERS
o $table_name
- The table name to check if it is matched by the wildcard.
o $wildcard
- The wildcard pattern to check against the table name. The wildcard pattern supports the same placeholders as MySQL replication
filters do. MySQL replication filters can be configured by using the MySQL Server configuration options --replicate-wild-do-table
and --replicate-wild-do-db. Please, consult the MySQL Reference Manual to learn more about this MySQL Server feature. The sup-
ported placeholders are:
o % - zero or more literals
o _ - one literal
Placeholders can be escaped using .
RETURN VALUES
Returns TRUE table_name is matched by wildcard. Otherwise, returns FALSE
EXAMPLES
Example #1
mysqlnd_ms_match_wild(3) example
<?php
var_dump(mysqlnd_ms_match_wild("schema_name.table_name", "schema%"));
var_dump(mysqlnd_ms_match_wild("abc", "_"));
var_dump(mysqlnd_ms_match_wild("table1", "table_"));
var_dump(mysqlnd_ms_match_wild("asia_customers", "%customers"));
var_dump(mysqlnd_ms_match_wild("funny%table","funny\%table"));
var_dump(mysqlnd_ms_match_wild("funnytable", "funny%table"));
?>
The above example will output:
bool(true)
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
PHP Documentation Group MYSQLND_MS_MATCH_WILD(3)