To enable load balancing on npmE server for allowing users to install packages from replica servers you need to configure Redis session replication.
Redis replication allows slave Redis servers to be exact copies of master servers so that can have the same login across servers.
To replicate Redis session follow the steps below:
Go to your primary server's admin dashboard settings page.
Select Expose Redis For Replication option from left panel.
To enable replication select
Expose Redis For Replicationsection and keep the
Upstream Redissection blank.
Now go to your secondary server's admin dashboard settings page.
Expose Redis For Replicationand select
Set the address of your primary server in
Upstream Redissection (Please note that
portis not required with the address of the primary server).
To check the replication status run
sudo docker exec -i npme-redis redis-cli info replication and verify the output shown as below:
role:slave master_host:your_primary_server_ip master_port:6379 master_link_status:up
To verify the redis replication, run
redis-cli info keyspace on both Upstream and Replica server and make sure the keys count matches on both servers.