Question

Here is one request on me for a Magento 2 website. The boss here wants to make the following. He have a Magento 2 web store with 3500 products and lot of orders per day. Cause sometimes the website is "failing"(last they there was an error with the hosting, and the website didn't work for days), he wants to make a mirror of the website and lets imagine the situation like this.

Working website is = A Cloned website is = B

When "A" fails to work for some reason, automatically the "B" to be "loaded" and the work can keep going smoothly without, losing his orders. The 2 websites "A", "B" to be on a same domain - www.example.com

Is that somehow possible ? How I can manage to do that? Do I have to buy another hosting and redirect the domain of "B" to point to "A" ?

Was it helpful?

Solution

Personally, I would try to talk the boss out of this idea. This sounds like a nightmare to me.

For starters, you'll have to maintain two Magento instances in the exact same state. All Magento versioning, all modules, all module versions, all environment variables, all server dependencies: everything will need to be an exact match or you risk catastrophe when you try to failover.

Then there's the database. If there are any core or module version discrepancies, there could be table changes that will torpedo your attempt to migrate the database to the failover site. I don't have to tell you how nasty Magento gets when tables don't match during migration.

You would for sure be doubling your maintenance workload, and possibly generating hours or days of troubleshooting trying to get the new site to work properly. The value of having a live mirror site would likely be wiped out by all that time.

In your shoes, I'd research strategies for regular backup and restoration. My former company has a system of AWS backups in place that, should a hacker take down their Magento site, would allow them to restore the site on a new clean server in a matter of minutes. I'm not a backup nor a server expert, but that's where I would start reading. The ROI of being down for an hour while you restore a backup on a new server is, in my mind, much better than the sunk cost of double maintenance forever and troubleshooting during migration in the midst of a critical failure.

OTHER TIPS

Another idea is to have 2 web nodes with a load balancer/ proxy in front of them. Each web node will connect to the same database, same Elasticsearch and Redis and should share the pub/media and pub/static folders.

Then there should be a deploy mechanism that ensures that the same copy of the code gets to the web nodes in an atomic way and the required symlinks and shared folders are properly attached afterwards.

Obviously, I don't have a clue about which are the costs and which is the budget that you have, but it's an idea worth exploring. If not in this project, maybe in next ones :)

Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top