Server Setup Question

Discussion in 'Servers and Control Panels' started by argonaut0, Oct 30, 2018.

  1. argonaut0

    argonaut0 Neophyte

    2
    1
    +0
    I run a medium-sized site. We’ve been on a lot of different configs over the years. We have a Wordpress and Xenforo install. The hosts sold us on a 2 server config at the time. The two servers sync files and databases. The problem is that the servers go out of sync to the point where we recently had to dump one copy of the database and go with the other. Also, file permission errors are often different between the two servers. Sync issues happen often. It’s a huge pain. And also users notice. Which, well, it’s upsetting that it’s frequent enough that users notice. We’re a good sized site, but the tiny little site down the road looks like it offers a way more seamless experience than we do.

    So, IMO this config isn’t working for us if we periodically lose data, permissions aren’t the same across servers and we can’t provide a seamless user experience. But the host isn’t providing other options and insist on trying to make this one work. Am I in the wrong? Can this config work? If not, what config do you think I should keep in mind while searching for a different host?
     
  2. we_are_borg

    we_are_borg Moderator

    4,605
    807
    +1,800
    Why two servers do you replicate and use the other server as backup or is there something else going on.
     
    • Also Wondering! Also Wondering! x 1
    • List
  3. mysiteguy

    mysiteguy Devotee

    2,587
    887
    +1,833
    If the host insists on their solution, I'd find another host.

    Here is how I would handle it on a medium-sized site (other solutions might be better for larger sites). I would not have two way mysql replication.

    Server A
    Web server with it's own file system
    Slave MariaDB database. All it does is read from the master. Xenforo, WordPress, etc. does not read/write to it. This will avoid any out of sync issues.
    lsyncd to sync web file changes to Server B. This avoids the overhead of NFS for sharing a single file system for web files.

    Server B
    Web server with it's own file system
    Master MariaDB database. All application read/writes are handled by this server.
    lsyncd to sync web file changes to Server A.

    lsyncd is a very good solution for keeping a large number of files in perfect sync. You might need to increase the inotify limits for it on each server, but once done it's lightning fast. How fast? On one of my dual server setups it keeps about 2 million files in sync.

    The only thing to keep in mind is to stop lsyncd if you're doing a large number of updates in a batch, such as upgrading Xenforo. Turn it back on after the update, and it will check all files for any needed sync if setup to resync from scratch at startup.

    BUT. all that aside, unless you must have 24/7 uptime and cannot afford an hour or so downtime in rare event of a catastrophic failure, then its probably not the best solution for a medium sized forum. And that means something like this is probably a better option:

    A single server with the resources to handle your site.

    A smaller server whose web server remains off line. Have it sync up hourly. Or maybe even live using lsync and mysql replication over a ssh tunnel. This server will get you by in a pinch, albeit slower, if the main server goes down. By keeping the TTL (time to live) values low for DNS records (5-10 minutes), you can switch over to the backup server relatively quick. Since syncing is one direction only, the likelihood of out of sync systems is very low.

    OR, if more than a couple of hours downtime in a rare emergency is acceptable: Operate one server with the resources to handle the site, and make sure it backs up changes on a regular basis (every hour, every four hours or whatever you feel comfortable with).

    There's nothing wrong with building for 100% uptime (or as close to it as budget reasonably allows), but I believe it needs to be weighed with how critical uptime is to a particular site, or if their money would be better spent elsewhere. And obviously at this point while you're paying for such a solution... it's actually causing more downtime the way they have it setup.
     
Verification:
Draft saved Draft deleted
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.