0

We have a clustered environment that our web sites run on. There are two web servers that are load balanced and one db server. All code is deployed to the primary server and automatically replicated to the secondary server using peersync software. This is a windows environment.

Wordpress works great in this environment with the exception of editing themes and uploading media. The problem is that any uploaded content needs to be uploaded to the primary server so that it will replicate to the secondary server. Replication is not two way. A file uploaded or changed on the secondary server will not sync to the primary server.

In the situation where a request for the admin side of the site is sent to the primary server, things work as expected. Uploaded images are uploaded to the path of wp-content/uploads and then replicated down to the secondary server.

The same is true for editing theme files. The wordpress admin edits the correct files for the currently active theme.

The issue is exposed if the load balancer sends the request to the secondary server. If a user uploads a file or edits a theme file via the admin, these files go on the secondary server, are not replicated to the primary server and the sites get out of sync. I've tried entering a network path (\primary_server\c$\inetpub\wwwroot...) in the miscellaneous settings dialog but wordpress doesn't seem to like network paths. I get an error when trying to upload images and Im 99% sure its not a security issue. It has to do with the format of the path.

Even if I were successful with entering a network path for image uploads, I'm unsure how to point the theme editor to a network location so that edits are being made to the files on the primary server rather than local.

We initially set up a rule that told the load balancer "if the request comes in with a subdoamin of www1, send request to the primary server" thinking that we could force all editing to occur on the primary server by having the end user go to www1.domain.com/wp-admin/ . The problem is that wordpress then wants to write all of the links in the content to be absolute to www1 which is not the intention. If all links and the content goes to www1, the site is no longer load balanced for all intents and purposes.

Can wordpress work in a clustered environment like I am describing? Using mod_rewrite isn't much of an option since on IIS though I know that there are plugins that enable this functionality.

2 Answers 2

1

If your load balancer will let you do this, look for the full admin path: "www.domain.com/wp-admin/" in the url and send requests for that to the primary server.

While your at it you should change the wp-admin folder to some other random name for security.

0

I solved this by using GlusterFS to provide a mount point that's common to both servers. It's way superior to using rsync since it handles deletes properly and supports failover - either node can fail and all will still work, and when it comes back it will auto-heal any missing files.

Inserting transparent cookies or using IP stickiness in your lod balancer solves the session problem.

Somewhat more difficult is the handling of theme and plugin updates, especially if you're using standard packages for your wordpress installation. This could also be put in gluster, but there are performance advantages in keeping it out.

You must log in to answer this question.