0

yesterday I have seted up a wordpress "clutser".

  • Two Front/Backend Servers for Nginx and PHP
  • One Database Server
  • on all there is installed memcached
  • I have a internal network, so no authenticate problems

My problem is now, to sync the /wp-content/-folder with all the plugins, themes and user-uploads. I have tested two ways: sshfs and unison. Both worked for file syncing... but wordpress never shows a picture?! And normal files (example: pdf) are only showed by one of my backend-servers on the other a 404 is coming.

Maybe someone had a similar problem and can help me.

Is there something else somebody know to secure my three servers?

Bye :)

Flo
  • 13
  • 3
  • If these three servers are serving a big site, are you sure you don't want to use some kind of distributed filesystem? – Zoredache Oct 26 '11 at 17:36
  • Normally you're absolutely right... _but_ actually there is no real site running on my cluster, this is more a future project, and I am a student (16years old)... so I can't rent big san-clusters and so on ;) – Flo Oct 26 '11 at 18:40
  • I didn't say anything about a SAN. I was thinking something more like DRBD, gluster, or something else. – Zoredache Oct 26 '11 at 18:46
  • The problem that sometimes I see a pdf and sometimes I get a 404, I have solved... that was a small nginx-rewrite mistake. – Flo Oct 27 '11 at 19:47

1 Answers1

0

I've had the same problem recently and I've been scouring the web for potential solutions. It seems that the most common suggestions are: rsync/unison/scp the files between the hosts or using some form of central file storage (like NFS or iSCSI). I'm not a fan of the central storage solution as it seems heavy handed and you still need to build some redundancy into that solution.

Rsync/Unison seem like the better option, but they must be executed on a regular basis to sync the files. I don't like the idea of running it from cron on a constant basis as both rsync and unison scan all files for changes each run. If you have a lot of files, this can cause excess overhead.

We've come up with our own solution which is quite simple. We wrote a simple Python daemon that does the following:

  1. Using pyinotify, we watched the wp-content folder for changes.
  2. Anytime a change was detected, we would execute a run of unison to synchronize the two servers.
  3. We'd also execute a run of unison on a regular basis, say every 15 minutes or so just to be safe.

This seems to work just fine for us so far. Note that this works best on a two server setup. If you have more than one server, this method will need to be tweaked.

Hope this answers your question.

vmfarms
  • 3,117
  • 20
  • 17