How to backup the database to cloud and how to have the data synchronized across multiple devices?

Asked

Viewed 2,742 times

3

Well folks my question is this.

I have an App that has a local Sqlite database. I want to know if you have any library, framework, code that does the following:

Backup that database to Cloud (Google’s own or Google’s server if it has any implementation for it) and allow the same database to be synchronized across multiple devices.

Let’s go to the example: I have 2 smartphones and 1 tablet.

  1. Smartphone 1
  2. Smartphone 2
  3. Tablet A

I installed my app on Smartphone 1. I used it, logged it into the database, altered it, deleted it. I want when I uninstall the App on Smartphone 1, and after a while, reinstall, all my data from when I had uninstalled be imported again as if the app had never been uninstalled. Also, that if I have the app installed on Smartphone 1 and want to install in the Tablet A, automatically all data that is on Smartphone 1 move to the App that is installed on Tablet A.

Now with the same App installed on two devices, if I make a change on one device, this change appears on the other, IE, are synchronized.

How do I do that, I’m totally lost in that part.

2 answers

10

Lucas there is technology for this, alias little new in the market and unknown.

Her name is: Symmetricds

Symmetricds is open source software for Both file and database Synchronization with support for multi-master Replication, Filtered Synchronization, and Transformation Across the network in a Heterogeneous Environment. It Supports Multiple subscribers with one Direction or bi-Directional, asynchronous data Replication. It uses web and database Technologies to replicate data as a scheduled or near real-time Operation. The software was Designed to Scale for a large number of nodes, work Across low-Bandwidth Connections, and Withstand periods of network outage. It Works with Most Operating systems, file systems, and Databases, including Oracle, Mysql, Mariadb, Postgresql, MS SQL Server (including Azure), IBM DB2, H2, HSQLDB, Derby, Firebird, Interbase, Informix, Greenplum, Sqlite (including Android), Sybase ASE, and Sybase ASA (SQL Anywhere) Databases.

In the company here we use it, it is very show your technology.

It is a tool for data replication, that is, it keeps instances up to date with each other, and the best is possible to impose rules, Transformation, Conflicts resolve and etc for all events: UPDATE, INSERT OR DELETE;

Imagine you have a MATRIX and requires that every time a product is created in its ERP the product comes magically appear in affiliate Erps, however, with some rules such as some fields that should not be populated, dates changed and etc.

Welcome to the Symmetricds.

It is made in java, so rest assured it has library of it for android, where it is mounted a node on the mobile that was installed the app and synchronized the local base with an online. Ai in the example that you gave that when installing you need everything to be populated in the local base just call the function Request Initial Load

Some features

inserir a descrição da imagem aqui

  • Easy and fast setup with an intuitive online dashboard, configure all nodes in a single interface. Reduce response time for conflicts and configuration without writing a line of code.

  • Monitor your entire network of Ode, possible conflicts and errors from a Dashboard. In addition to having access to the status of all nodes, such as the status of the registry that was changed, deleted or created.

  • Handle offline periods of disconnected operation and make efficient use of low bandwidth networks. With durability to ensure data delivery, the system automatically recovers from crashes.

  • Dimensioning for large networks of thousands of nodes and leveraging out of the box holder for cluster nodes, load balancing, high-performance mass loading, and the n-Tier configuration.

  • Synchronize data across a heterogeneous enterprise and gain the freedom to choose the database that matches your request with broad support for database platforms and operating systems.

  • Synchronize files and folders on different operating systems with the same data synchronization engine which is powerful and flexible enough to configure and customize.

  • Integrate with external systems using included interfaces of JMS, JDBC, REST, and FTP. Expand functionality using point extensions and scripts. Embed in custom apps.

  • Manipulate change data during multiple synchronization phases with internal transformations and custom scripts that filter, subset, translate, merge and enrich data.

  • Enhance bi-directional sync consistency by configuring conflict management with automated rules, custom solvers, or manual resolution from a screen.

Some images

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • I had already taken a look at this Symmetricds but I didn’t find the documentation very good nor examples using Android. Who makes the synchronization logic? Could explain better how works in the practical part this Symmetricds?

  • I have already explained how it works in practice. Documentation of it is very abortive in the use of the non example functions of software use. It keeps monitoring your bank, every change in the bank it does something, if you want to synchronize to another bank, if you want to transform the data and send and etc. If the master bank also undergoes changes it receives and synchronizes in the local bank. It’s 100% what you’re looking for.

  • Boy, I really like the concept of the tool! I’m going to take a look now.

  • 1

    @Tinmegali is sensational her. Here we have matrix more than 10 branches working non-stop, and with data integrity.

  • @Tinmegali without saying that it works without internet ;) I mean, even if it has no connection it monitors and records everything, when it returns it maintains the same bases :)

  • @juniorb2ss in case I would install this software on my linux server with mysql and also implement a lib in the Android app? Then I do my normal CRUD functions which it records and does all the work or functions of it for CRUD?

  • 1

    On your server you install it and configure it as master. On the mobile you use the library and install a Node. The Software is just a spy for your database, it doesn’t enter anything into your code, it monitors your database. By triggers he manages all changes, if any occur he replicates to the master.

  • @LucasSantos https://www.youtube.com/watch?v=zuXWCAzIj5g

  • @juniorb2ss How much does the PRO version cost?

  • @Lucassantos $15,000. But it’s open source. The license is for his specialized support and serial for the console. But functionality does not change anything, because it is open source.

  • @juniorb2ss as you run it with the community version, I did the dowload, but do not know how I run it, can help me?

  • @Alisson community version is only by commandline, you need to run the querys directly in the bank to go creating the settings. I recommend downloading the pro version, it is possible to generate a license for 30 days, when you get the hang of it, run the community

Show 7 more comments

3

There are some alternatives that can solve your problem, but the logic of synchronization will be on you. There is a service model called mbas (Mobile Backend as a Service - wiki) that does just that. Provides an easy-to-set backend and usually with support for multiple systems.

There are many options. A very popular and with a good free account is the Parse.com. You can use something like Baasbox, which is opensource and install on your server as well.

Now, the logic and the code of the synchronization will be for everything my friend. I have no knowledge of a library that does this for you. Basically you need to keep ps records of the device and the cloud records with the same update dates. You could also register the Devices user and use flags on your server to inform other users when they need an update, sending requests only when necessary.

The discussion of as doing this is too philosophical. Good luck out there.

Update: Security and "ownership" of objects in mBasS ( issue raised in comments)

If security is a key feature of your application success, mBasS services may not be the ideal solution. I think that due to the ease of configuration and use of the service, some decisions have been made (in terms of design) that harm this side.

By default Parse keeps the access of his objects fully open (what I consider something bizarre), but there is the possibility of using lists ACL (Access Control List), which are definitely not the most secure architecture in the world. Through ACL you define user permissions lists on each registered object. If you need one more layer of security, you can do another authentication on the server using the user’s session, for example. But it is necessary to develop this in Cloudcode which is a js sdk with some rather confusing functions.

Once the ACL is applied you can only query the objects registered to the user, for example.

  • In case I don’t use any technology to help my problem, your comment helped me in the part of registering the user’s Vices and using flags to know when to update other devices or not. I had thought about it yesterday and now the idea has been strengthened.

  • @Lucassantos in Symmetric it supports this, you create a field and every time there is an INSERT you send the NODE_ID, which means where this data comes from. And in Symmetric you define that only he can see the data that has the NODE_ID of it, so if I create a record in cell A the cell B will not receive, however, if in MATRIX I edit this record the cell A will receive.

  • It does not do this part if I create a record on Mobile A the cell B receive also?

  • 1

    @Lucassantos If you want it that way, yeah.

  • @Tin Megali this Parse is good for what I want? I took a look at him. It’s weird this kind of service, it’s like I don’t use a database of my own or local or remote, use theirs, is that right? And how the relationship is done?

  • @Lucas, you can use your local DB, but on the server it’s their bank. However in the SDK they offer a kind of cache that saves the files locally. They don’t explain very well in the documentation how this works, but I suppose Parse creates a local DB and manages these operations through the SDK. Due to this lack of control and possible dependency, in the application I developed in Parse I used my DB and made the server operations using the REST they offer. I warn you that the doc. of REST is terrible and some operations are boring to do.

  • @Lucassantos I think the biggest problem would be in the case of a future change. As it is a commercial tool, it certainly should not be the easiest thing to rescue all your data and transfer to a server for example. I believe Baasbox should release version 1.0 this year. If I’m not mistaken it’s 0.94. Baasbox is pretty cool. You can install on your server, even on your machine. The only problem is that I believe it has not yet reached maturity for a commercial application. But in my test scenario I had no problem. I installed in Amazon and spun filet.

  • @Tinmegali I really think the best option will be for me to develop my own way of timing. Thanks for the help.

  • One last question @Tinmegali, these services like Parse, how do they treat the relationship? Since on their side is a Nosql server all JSON base. For example, with these services like Parse and Firebase, can I have an authenticated user, and the data I submit will be separated by each user? And how would I do the relationship, display only categories that are registered for a particular user or that are related to an id of something else. Foreign key type.

  • 1

    @Lucassantos the answer got a little big. I’ll put edit my text above. Good that it is documented for everyone

Show 5 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.