Results 21 to 23 of 23
Hybrid View
-
27th Mar 2012, 05:00 AM #1Member
I have few expriences in this field. If you have less/or equal 4 servers, it's best to setup 1 instance of MySQL. More than 4 servers, 2 mysql run in replication mode (one master and many slaves). Why? In high traffic website (I'm talking hundreds thousands visits in day or more) MySQL use a lot of RAM and CPU, try to seperate it from PHP and WebServer for best performance.
If you have more than 2 web server, and one extra for mysql, use the extra one for load balancer. The best software load balancer out there is nginx. You can config nginx to balance the request to your 2 web servers. If one web server goes down, you still have the other.
Now, for MySQL. If you have mysql run in replication mode (means 1 master server, and many slave), config for each web server connect to different mysql server. Now, if you have only 2 mysql server (1 master & 1 slave), you can config you web server read from master. If you have more than 3 (1 master & 2 slaves), do not config your web server to read from master, only read from slave. Any modification operation happens to database (UPDATE, INSERT, DELETE) you will have to perform on the master, and those modifications will be mirrored to slave. If you perform modification operations on slave, it will not change the master and other slave, go figure.
Next thing is PHP Session. Now, you have more than 2 web servers, each one will give the client different session id, and (maybe) store different session data. So, we will have to store php session in one place. There are many ways to do that: file, mysql, memcached, redis... Now, forget the session to file solution, one reason: it sucks. Well, the easiest way is to store php session in mysql. But the best way is to store in memcached, which is lightning fast.
Code:Memcached: http://pureform.wordpress.com/2009/04/08/memcache-mysql-php-session-handler/ MySQL: http://www.tonymarston.net/php-mysql/session-handler.html
And one more thing, in nginx load balancer, there are 2 ways to load balance between servers:
1. Equally divide: client make 5 requests to your webserver (assume you're load balancing between 3 web servers), load balancer will do like this: request 1 go to svr A, req 2 go to svr B, req 3 go to C, req 4 go to A, req 5 go to B. Pros: CPU + RAM load is balanced. Cons: different session.
2. Stay in one server: client 1 make 5 requests, load balancer forwards all request to svr A and all further request will go to svr A. Client 2 make requests, all will go to svr B. Pros: no session problems. Cons: one svr may have more stress than the others, and when one go down, one other svr will take all the stress from the down svr, and there will be a chain reaction.Hotaru Reviewed by Hotaru on . Multiple servers. I want to know about single site and multiple network. That is, can I host 1 site on 2 servers? If one goes down, site continues to work from other one. Say A is the site with X and Y IP . Then I add both NS. Will this work or? Thank you! Rating: 5
-
27th Mar 2012, 06:05 AM #2BannedWebsite's:
vaporhostn.comWhat your looking for is a replication server.
The replication server can be turned into a production server or a write only server (replication).
If for any reason the first server goes down then you can turn the replication server to production.
All the replication server will do is copy each and every change you make on the other server to the new one. But its not a easy task as it needs custom scripts.
You can also run a cluster server in which each server connects to each and it will work like a replicated server. But that is something i cannot explain as the documentation is needed since detail is better then just a summary.
-
27th Mar 2012, 07:01 PM #3The Wise OneWebsite's:
twilight.ws ddlrank.comMost of the time you have 2 servers of each:
2 load balancers (1 active and 1 in standby mode) => this means you have one floating IP which routes to the active load balancer
eg:
load balancer 1: 192.168.0.1
load balancer 2: 192.168.0.2
floating IP: 192.168.0.3
All websites will point to the 192.168.0.3 which will then automatically switch (google for ucarp) to the active load balancer.
Mysql will be master/slave of which the slave can take over if the master may crash. Master/slave is still not 100% so if you get corrupt data on the master it will write it to the slave too causing you to have bad data on both servers
Ive read my stuff here: http://insanecoderz.org/359/server-a...r-debianubuntu
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Multiple Servers With Different Control Panels?
By bnehost in forum Hosting DiscussionReplies: 10Last Post: 19th Sep 2012, 06:45 PM -
[Dedicated] NOVANODES 1GBPS/10GBPS/100MBPS,Unmetered,EU servers,DDOS Prot.US servers from $52/m
By Novaroot in forum ArchiveReplies: 2Last Post: 22nd Feb 2012, 07:41 PM -
Multiple Sites With Multiple Domains On Shared Hosting?
By DuckBre in forum Webmaster DiscussionReplies: 6Last Post: 24th Aug 2011, 03:47 AM -
Use one domain with multiple servers
By Ruriko in forum Server ManagementReplies: 3Last Post: 2nd Aug 2011, 11:37 AM -
SEO Benifits of sites on multiple Class C ranges... And even in multiple countries
By SplitIce in forum Webmaster DiscussionReplies: 3Last Post: 22nd Jan 2011, 02:57 AM
themaCreator - create posts from...
Version 3.47 released. Open older version (or...