The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

live mirror questions

Discussion in 'General Discussion' started by ddh, Aug 29, 2008.

  1. ddh

    ddh Registered

    Joined:
    Jun 6, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    The Netherlands
    Hi,

    I host a number of smaller websites on a Linux Cpanel VPS, and am looking into setting up a live mirror in a different datacenter. So far I understand this to require the following elements:

    1. setup two identical servers (with at least the same software)
    2. setup a dns failover, so that when the primary server becomes unavailable, it sends the traffic to server two.
    3. setup dns synchronisation between the two cpanel servers
    4. use rsync to sync the /home folder from server 1 to server 2. (like here)
    5. setup mysql master-slave replication between server 1 and server 2. (like here)

    (I gave the tuto's in the hope of perhaps helping others)

    Now my questions, if you please:
    1. Why should I use dns failover, and can't I simply have my 1st and 2nd nameservers point to server 1, and the 3rd and 4th to server two? This should ensure a seamless transition when server 1 becomes unavailable. But am I missing something here?
    2. I'm wondering what to do with changes made on the second server, while the first one is down. For changes in the database (i.e. orders in a webshop), I guess I could setup a mysql master-master relationship (like here), but what if file changes are made on server two (i.e. the site owner updates a product image) is there any way to transfer those to server 1 when it becomes available again?

    Can anyone please shed some light on my questions? Maybe I'm going about this in totally the wrong way, I'd love to hear that too.

    Thanks!

    David
     
  2. Murtaza_t

    Murtaza_t Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    476
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    Hello,

    It depends on what setup are you looking for..? whether you want to have a load balancing setup to shared traffic or a fail over setup.

    If you are looking for a load balanced setup then you will need some additional scripts that will copy data to and fro as files will get updated simultaneously on both the servers... a bit complicated and not 100% reliable. In this case you will need to point the DNS to both the servers like "1st and 2nd nameservers point to server 1, and the 3rd and 4th to server two"

    However from the information that you have provided.. I suppose you are looking for a fail over setup.. Here you will need the DNS on server 2 to take over only if the DNS on server 1 has gone down. You can use the MySQL master-master setup to copy the mysql data or can even use a SAN/NAS drives which will make your setup look a bit decent. And to copy data you will need to run a script on startup of server 1 to sync data from server 2 before taking over from it. I would recommend you to use server 2 as a backup of server 1 and it will only become active if server 1 is not available.. so that the traffic is flowing the either way and not 2 way at the same time.

    You can refer this LINK for more help and advance setup.
     
  3. hodfords

    hodfords Active Member

    Joined:
    Feb 22, 2002
    Messages:
    43
    Likes Received:
    1
    Trophy Points:
    6
    Agreed. Moosa is right. The way DNS's work is that it's not always sequential

    so if you have

    ns1 - server1
    ns2 - server1
    ns3 - server2
    ns4 - server2

    A lot of the times server2 will get traffic even though it should serve as a "hot standby"

    What we are concerned about now is how to sync stuff like:-

    - Cpanel Theme
    - Users / Groups created on master server
    - exim config
    - mail queue retry times
    - WHM / Cpanel settings
    - log files
    etc etc

    If somebody has a working version - would really appreciate if they could share it with us.... alternatively if we come up with something we will post details about how we did it...
     
  4. Murtaza_t

    Murtaza_t Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    476
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    The Entire setup can be rSynced from one server to another along with file permissions and ownership.

    The idea handling the DNS request is most important. As you cannot have 2 different IPs for your site. the site will not work for ISP who use their cache to resolve the website at the time when the main server is down.

    This can be achieved by configuring a loopback adapter on the server. I can provide you the details if you let me know the exact requirement.
     
Loading...

Share This Page