Jump to content

Processwire on 2 servers running behind a load balancer


mike131
 Share

Recommended Posts

Hi,

I currently have 2 servers behind a load balancer.

Each of these servers are running processwire, but there is an issue with files management (site/assets/files)

Each one would have a separate set of files depending on which server you "hit" when you make changes/upload.

Does anyone know of a good way to handle this without losing files?

Thank you!

Link to comment
Share on other sites

You can make a master / slave configuration with continuous syncing from one to another.  For this to work you would have to make sure that admin traffic is only routed to one ("master") server. You could use rsync (which could be triggered by a module after onPageSave), the more "true" way as far as I understood is block level syncing. I don't know anything about this however.

Alternatively, you could for example mount one server's /assets/ folder into the other one. This makes sure you always read / write to the same dir. In this case, you should make sure in your application logic that the same information cannot be stored at the same time from different servers. You could also combine these two options.

  • Like 1
Link to comment
Share on other sites

Hello,

You might want to look at HAProxy. Here's a nice article on using it.

https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-mysql-load-balancing--3

And this is an article on how to set up master-master Mysql replication.

https://www.digitalocean.com/community/tutorials/how-to-set-up-mysql-master-master-replication

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...