0

Let's suppose that I will create an e-commerce for a restaurant chain that has several restaurants and in each restaurant the menu is a little different. The user will enter the website and input its zip code. Based on the zip code he will be redirected to the nearest restaurant menu.

How can I create multiple stores or websites in which each will have its own database?

The higher purpose of this is: speed (one database for the several restaurants would be slow) and sync (I need to figure some way to sync the products on the restaurant with Magento's database. To make sure that users can't buy something that is out of stock.)

The solution that I've thought is to have the homepage in one server and several other servers with one Magento installation for each restaurant. But this would be insane.

A similar question has been asked. But the answers were confusing and nonconclusive.

1

Are separate store views, one for each restaurant, not what you want? See All Stores Documentation. In this instance, I would suggest you use a single instance of Magento with either separate store views or separate stores. This way all your stores can share a single product catalog but present each item differently (different price, content, imagery, etc.).

I don't believe you can shard the database like that (by store). I know you in Commerce edition you can shard the database to separate out the commerce tables from the content tables from the OMS tables, see Split Database Performance Solution.

Another option you have is to run Magento headless. You can set Magento up with as many store views or stores as you need, then run any CMS you want (Drupal, Wordpress, Typo3) or a custom HTML site, and power the menu from data from the Magento API. You would still have the limitation of one database and one Magento instance, but you'd have more control over the entire look and feel of everything instead of being constrained by Magento's layout and what not.

0

It's not possible with out of the box Magento, to implement something like this would require heavy core logic customization, which could lead into unforseen and hard to predict consequences.

Also it highly depends on the number of products and webstores(restaurants) you would have to sustain, and would all the products be unique per webstore. Maybe default magento approach with shared catalog would work for you

  • And which twelve restaurants will even agree on the id of 100 menu items? – Wilson Hauck Jan 23 at 20:46
0

The higher purpose of this is: speed (one database for the several restaurants would be slow)

fortunately, this is not a problem. at all.

You are not building a space shuttle to go to the next room. Make a simple step maybe few steps.

Magento easily separates categories and products per store/website view. This is builtin feature.

To prepare for the expected traffic or in general for the load, you need to build your shop in the cloud.

Your first problem will be php, not database as you think. Auto-scalable solution to launch multiple instances to process php requests - is all you need at this stage.

The solution that I've thought is to have the homepage in one server and several other servers with one Magento installation for each restaurant. But this would be insane.

this is not insane - this is correct approach. you can build auto-scalable solution to proxy backends per domain, magento action/route, or even per user cookie/action. this is exactly how it works. you dont have to install magento on every server, you just scale-clone its core files. as media and other static / sessions will be shared.

Only after you see that you have steady traffic and database IS the problem, you can go with separation, read/write , proxysql, pxc cluster, there are lots of tools ready to help you with this.

you can simply clone your database and using proxysql create read/write, or master-slave cluster in sync.

but this is impossible to share anything here, because we dont know your environment, shop settings and your DBA management skills. for this you have to start from percona page: https://www.percona.com/software/mysql-database/percona-xtradb-cluster

and proxysql page: https://www.proxysql.com/

or probably you go with AWS Database configuration, they have some options to manage replicas and db-scaling.

  • The problem with creating several servers is: how to keep the user data synchronized across all servers? Since I will deploy one server for each restaurant with its own products db, the user db would also be unique, but this is undesirable. – Antonio Araujo Jan 21 at 13:37
  • @AntonioAraujo you dont need separate databases! separation is inside magento level, you create multiple stores, with catalog per store separation. you need to start from magento documentation. – MagenX Jan 21 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.