0

Im building a application that should work online and off-line.

I will have this application on any fisical stores and a administration on web application that should for all systems installed locale on the store.

I have any actions insert and update that system web should execute and systems local keep insert and update actions all time, but they cannot depends of internet, because this I need a database local.

I try use galera clusters and replication master master,

Galera clusters work nice but when a node get offline it node stop work, this node is a store and the store cannot stop.

Replication master master generate primary key conflit.

Which tool could help me on this situation.

Updated

To simplification,

All data generated by stored offline wont should affect other store, i mean orders, clients, payments. the datas can are on all database, but the store will see just self data.

System admnistration online, should see all datas of all stores and will have any actions insert and update above all stores like, block clientes, aprove orders, generated stoke,

but all actions that System admnistration online will be able, the store will not be able, example, just System admnistration online can create products, make stoke and block clients.

  • In `master-master` replication, if you have an auto generated primary key that uses sequence, you don't want each node generating successive key to avoid conflict. To resolve such issue, you can configure one node to generate odd numbers while configure the other to generate even numbers. For more nodes, you would want to increment more than the number of nodes. – alvits Jul 28 '17 at 01:19
  • It's not entirely clear how your setup looks like. If you are trying to create a global database that everyone can update even if offline, you won't get happy with replication; you will need a syncronization process for cases where two stores e.g. update the same customer. Look at some POS-system to get an idea. If you want e.g. global reporting or backup, you could, if you want, use master-slave-replication. If you want to give the admin local access, you could do just give him access to the local db (without access if offline, but he could then look (not update) in the global backup). – Solarflare Jul 28 '17 at 08:39
  • To summarize: clarify for yourself what you are trying to do exactly. Define what needs to work offline and online; you could e.g. just allow "emergency function" like payment when offline. And do not underestimate it. Synchronizing offline databases is not an easy task. – Solarflare Jul 28 '17 at 08:44
  • well is Basically this, i looking for use multi source replication, where each store will have a slave replication online just for admnistration system (online system look reports), but i have any actions than system admnistration (online system) should to do, for example, online system shoud register products and this product should are avaliable on all stores, when they get connection success. – Ricardo Patrick Jul 28 '17 at 16:37
  • Other situation, the store system (off line system), will keep generating orders and this order will be replicated to slave. but have any types of payment that just system administration (online system) should approve. – Ricardo Patrick Jul 28 '17 at 16:45
  • Since the functions (seem) to not overlap, you can, in theory, actually do this with master-master replication if you are really careful and design your database correctly. I would still recommend to write a synchronization app. It can copy data AND is able to apply logic (and is (able to be) robust to errors). If you use only replication, the logic has to be designed into the datamodel itself (as replication basically just copies data and the functionality has to emerge from only this). It is possible, and if you feel up for that, do it. Otherwise you might try a safer/more flexible approach. – Solarflare Jul 29 '17 at 12:19
  • Just to clarify: the "app" doesn't have to be an actual external app, and you could still utilize replication; your server could e.g. consist of one (master-slave)-admin-db that gets replicated TO all shops, and a (master-slave)-db for every store that gets replicated FROM each shop. Your "app" could be a combination of events, triggers, php, ... to apply the sync-logic between the admin-db and the other dbs. You still need appropriate design, but it's more flexible and you wouldn't have to write the data-copy-part. I would still not recommend it, but maybe it's a viable middle ground for you. – Solarflare Jul 29 '17 at 13:49
  • And to repeat my tipp: please look at any standard software and how it does it. Basically every pos software that supports local shops will have to fulfill the requirement that it has to (at least rudimentary) work even without internet/connection to the server. There are lots of concepts to tackle that problem (from: "we expect the internet and the main server not to go down ever, otherwise we take a break" over "just supporting basic function" to "we plan for and can live with a traveling salesman that only sometimes uploads data"), so you might not have to reinvent (just build) the wheel. – Solarflare Jul 29 '17 at 13:51

0 Answers0