cancel
Showing results for 
Search instead for 
Did you mean: 

magento 2 multiple servers file configuration with loadbalancer

magento 2 multiple servers file configuration with loadbalancer

I have setup a magento 2 website using 2 servers,

but when I input some data to magento like add product with image.

the other server cannot show and get the product.

Is there any file needed to share between two servers

or any configuration needed to setup.

Thanks!

8 REPLIES 8

Re: magento 2 multiple servers file configuration with loadbalancer

Hello @cheung_hoi ching2 

 

I do not know you are set up that 

 

but make sure below points

1) make sure same db use

2) make sure media dir sharable between two server

 

 

Hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: magento 2 multiple servers file configuration with loadbalancer

Hi @cheung_hoi ching2 

 

You mean you want to use Magento Multisite concept ? Where in everything should be same on both the sites ? with few different functionalities ?

 

If yes - then you don't require to setup your single magento instance on two server instead you can use Single Magento instance and use Magento multisite concept in it - where in single database will be used and single magento setup will be used.

 

Here i am sharing link to setup magento 2 multi-site - https://www.simicart.com/blog/magento-2-multiple-stores-domains/

 

If you still want to continue with your two server setup and share product between two magento setups then i would say - you will require to create a bridge file which connects two Magento setup with each other and transfer the data using API or may be via direct database connection.

 

Hope it helps !

if issue solved,Click Kudos & Accept as Solution

Re: magento 2 multiple servers file configuration with loadbalancer

I guess you want to create a Magento 2 cluster with 2 or more application nodes? What is your intention to create a cluster, for high availability or do you want to spread the load across the nodes? Depending on your use case, it's also important to create a cluster of your database environment (mariadb/mysql) as hot or cold standby nodes.

Independently of your use case, you have to ensure, that your database (cluster) is configured on all applications nodes (in app/etc/env.php). Then you need shared storage mounted into /pub/ or /pub/media/ which shares the common files between your application nodes. In most cases, shared storage could be slow, e.g. if it's mounted as FTP into the file system of the nodes. In this case, also ensure that you add some caching layer or CDN in front of your web servers (e.g. Varnish cache) to deliver static files like JS, CSS, images, etc. by your caching layer. 

 

Re: magento 2 multiple servers file configuration with loadbalancer

I would like to know which dir needed to share between two server.

 

Thanks!

Re: magento 2 multiple servers file configuration with loadbalancer

Share the /pub/media/ folder between the servers. If you also using FPC on your file system, also share /pub/cache/

Re: magento 2 multiple servers file configuration with loadbalancer

Are the dir pub/static , page_cache and other session dir needed to share?

Thanks!

Re: magento 2 multiple servers file configuration with loadbalancer


@cheung_hoi ching2 wrote:

I have setup a magento 2 website using 2 servers,

but when I input some data to magento like add product with image.

the other server cannot show and get the product.

Is there any file needed to share between two servers

or any configuration needed to setup.

Thanks!


Hello,

 

Did you ever get your multiple server setup working? We are trying to set up a similar situation (multiple servers behind a load balancer) and I can't seem to find any authoritative documentation or best practices on how to set this up for maximum consistency.

Re: magento 2 multiple servers file configuration with loadbalancer

I need to do this is there a guide somewhere you could share me please? I want a configuration that allows unlimited traffic scalability in aws. so I guess what you mention is that each server is sync with each other.

 

I alreayd exported the DB to an external DB (aurora) but not sure how to continue.