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

3

Good people, my doubt is as follows.

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 this database to Cloud (Own server or Google if it has some implementation for it) and allow the same database to be synchronized between multiple devices.

Let's go to the example: I have 2 Smartphones and 1 Tablet .

  • Smartphone 1
  • Smartphone 2
  • Tablet A
  • I installed my app on Smartphone 1 . I used, made records in the database, changed, deletei. I want it when I uninstall the App on Smartphone 1 , and after a while, reinstall, all my data from when I had uninstalled are imported again as if the app had never been uninstalled. And also, that if I have the App installed on Smartphone 1 and want to install on Tablet A all the data that is on Smartphone 1 goes to the App that is installed on Tablet A .

    >

    Now with the same App installed on two devices, if I make any changes to one device, that change appears in the other, ie they are synchronized.

    How do I do this, I'm totally lost in that part.

        
    asked by anonymous 01.10.2015 / 22:08

    2 answers

    9

    Lucas does exist technology for this, alias little new in the market and unknown.

    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 large numbers of nodes, work across low-bandwidth connections, and withstand periods of network outage. SQL Server (including Azure), IBM DB2, H2, HSQLDB, Derby, Firebird, Interbase, Informix, Greenplum, SQLite (including Oracle Database, 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 maintains up-to-date instances of each other, and it is best to impose rules, transformation, conflicts solving and etc for all events: UPDATE , INSERT ;

    Imagine that you have a MATRIX and require that every time a product is created in the ERP, the product will appear magically in branch offices' ERPs, however, with some rules such as some fields that should not be populated, dates changed, and so on.

    Welcome to SymmetricDS.

    It is done in java, so rest assured that it has a library of it for android, where a DELETE is mounted on the mobile phone that was installed the app and synchronized the local base with an online one. In the example that gave the installation that everything is populated in the local base just call the function node

    Some functionalities

    • Easyandfastconfigurationwithanintuitivedashboardonline,configureallnodesinasingleinterface.Reduceresponsetimeforconflictsandconfigurationwithoutwritingalineofcode.

    • Monitoryourentirenodenetwork,possibleconflictsanderrorsonadashboard.Inadditiontohavingaccesstothestatusofallnodes,suchasrecordstatusthathasbeenchanged,deletedorcreated.

    • Handleofflineperiodsofdisconnectedoperationandmakeefficientuseoflow-bandwidthnetworks.Withdurabilitytoensuredatadelivery,thesystemautomaticallyrecoversfromfailures.

    • Scaleforlargenetworksofthousandsofnodesandleverageoutofboxsupportforclusternodes,loadbalancing,high-performancebulkloading,andthen-tierconfiguration.

      /li>
    • Synchronizedatainaheterogeneousenterpriseandgainthefreedomtochoosethedatabasethatmatchesyourrequestwithbroadsupportfordatabaseplatformsandoperatingsystems.

    • Synchronizefilesandfoldersondifferentoperatingsystemswiththesamedatasynchronizationenginethatispowerfulandflexibleenoughtoconfigureandcustomize.

    • Integratewithexternalsystemsusingbuilt-inJMS,JDBC,REST,andFTPinterfaces.Expandfunctionalitybyusingextensionsandscripts.Embedincustomapplications.

    • Manipulatechangedataduringvariousphasesofsynchronizationwithinternaltransformationsandcustomscriptsthatfilter,subset,translate,merge,andenrichthedata.

    • Enhancebidirectionalsynchronizationconsistencybyconfiguringconflictmanagementwithautomatedrules,customresolvers,ormanualresolutionfromascreen.

    Someimages

        
    02.10.2015 / 14:53
    3

    There are some alternatives that can solve your problem, but the synchronization logic will be up to you. There is a service template called mBaS (Mobile Backend as a Service - wiki ) that does exactly. Provides an easy-to-configure backend and often supports multiple systems.

    There are many options. One quite popular and with a good free account is Parse.com . You can use something like BaasBox , which is openSource and install on your server as well.

    Now, the logic and sync code will stay out of everything my plate counts. I'm not aware of a library that does it for you. Basically you need to keep ps device records and cloud records with the same update dates. You could also register the devices of the user and use flags on your server to inform other devices when they need updating, sending requests only when needed.

    The discussion of how to do this is too philosophical. Good luck out there.

    Update : Security and "ownership" of the objets in mBasS (question raised in the comments)

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

    By default, Parse keeps access to your objects fully open (which I find somewhat bizarre), but there is the possibility of using ACL (Access Control List) lists, which are definitely not the architecture the safest in the world. Through ACL you define user permissions lists on each registered object. If you need another layer of security it is possible to do another authentication on the server using the user session, for example. But it is necessary to develop this in CloudCode which is a sdk js with some pretty confusing functions.

    Once the ACLs are applied you can only query the objects registered to the user, for example.

        
    02.10.2015 / 14:47