cancel
Showing results for 
Search instead for 
Did you mean: 

Configuration inconsistency with multiple frontends behind load balancer

Configuration inconsistency with multiple frontends behind load balancer

Hello, I'm currently running Magento CE 2.3.4 in a configuration with one frontend web server behind a load balancer. Currently the load balancer is set up to send requests to just the one web server, and this configuration is working with no problems. Our next step is to add two additional frontends, so that the load can be balanced between the three servers.

 

I have not found any documentation on how to set up a configuration like this for Magento, so I've been trying to get it working through trial and error. So far I've done the following which seems to have helped:

1. Switched all caching (full-page cache, default cache, and session cache) to use a shared Redis server, instead of Magento's default disk-based cache. This seems to have eliminated issues with sessions/logins/cart contents where certain items were cached only on one of the frontends.

2. Set up the load balancer to direct all admin and rest api requests to a specific server, so that any uploaded image files are sure to go to that server, and then set up an rsync job to sync image files to the other servers.

 

However, I'm still having an issue where the behavior of the configuration (from app/etc/env.php and app/etc/config.php) seems to be inconsistent between the various frontends. If I attempt to have all the configuration files the same, I get an exception error like the following:

 

main.CRITICAL: The configuration file has changed. Run the "app:config:import" or the "setup:upgrade" command to synchronize the configuration.

When I run this command on a given frontend, the exception will go away on that frontend, but then will pop up on another frontend, and so on and so forth. I guess I am not sure how to properly manage these configuration files in a multiple-frontend scenario.

 

I have also noticed that occasionally some configuration options in the Magento admin are greyed out, when normally with a single server I would be able to access them. I am thinking this has something to do with having multiple versions of the configuration files, but I'm not sure. Maybe it's also related to using a shared Redis cache?

 

I'd appreciate any advice folks have, or any pointers to reference documents or guides on how to set up something like this.