Local Firebird db replication/sync to online db

2019-02-28 09:52发布

I am looking for a tip how to synchronize data from a local firebird database into online db? Few comments:

  1. On a local machine I use sales software which keeps data on firebird db. There is an internet connection, but I want to avoid direct db access (as the PC after 9pm is being turned off).
  2. I would like to create an online app (based on foundation + php + database) in which I will be able to view daily sales and explore past data.
  3. In local db, I will need to pull data from several different tables, and I would like to keep them in online/final db as a single table (with fields: #id, transaction date, transaction value, sales manager).

While mostly I know how to create frontend of the app, and partially backend still I wonder what would be best choice in terms of db - mysql? (it was my first thought). Or rather I should focus on NoSQL?

What's your recommendation on data sync? I should use symmetricsDB (pretty hard to configure) or equivalent, I should write a script which will push data from firebird into json/xml? I'm referring to your knowledge and best practices

2条回答
甜甜的少女心
2楼-- · 2019-02-28 10:25

Firebird also in version 2.5 has all technology already build in to implement a fully functional replication. We have implemented this in the largest installation for a big restaurant company with about 0.6 billion records, daily about 1 million new records and 150 locations where replicated servers are working online or offline with the back office software.

If you simply want to upload the data from your local db to a remote db, you can rent a virtual server at a provider you like, install firebird there, create a secure connection (we use ssh, but any tcp over vpn can be used). copy your local database to the remote server, if required open firewall fb port (3050 or other) and when you a low number of writes on your local database, simply implement a trigger on each table, that does the same insert/update/delete with the same values using the "execute statement on external" feature.

When your local database has higher workload, it is better to put the change data (table name and pk values) from trigger into a log table and let a second connection upload the records to the target db, where the same "execute statement on external" can be used.

this is just a hint how to do that, if budget allows, we can do it for you, but stopping the database pc in the evening seems to be only typical for smaller companies

查看更多
对你真心纯属浪费
3楼-- · 2019-02-28 10:37
  • Put a scheduled job that will invoke a simple data pump / replication script.
  • From the script, connect to the source sales db, retrieve the joined data added from last replication and insert them into the "online" database.
  • You may keep also Firebird as online DB as it works great with PHP.
查看更多
登录 后发表回答