Offline vs. online replication, n-way

Q: I have downloaded and tried IbReplicator, and I have a question about it:
  • I want to use offline sync, how can I test it on my own pc? E.g. what are some default configs, do's and dont's?
  • I use it as two way sync? So duplex sync? (as far as it is possible) And how, do's and dont's?

____

A: Offline and online replication are almost the same. In offline you must in addition select what offline media to use (FTP, mail, netdir). To test on own PC is the best checking config use netdir (shared directory). For communicator setup look in help (or in sources).

Two way sync is possible if you setup two oposite schemas and run 2 servers. But there is not implemented conflict manager. If you change the same record on both sides in time between two replications, it will first overwrite second one. More probable when is long replication period.


Q: Ok, I set up this two way sync, make a change in the first, IbReplication will change it in the second, comes this change back in the first? Thus, circulate endlessly?


A: No that is not problem, you setup one SQL user e.g. 'IBREPL_1' for both schemes.

Problem is: DB1 record changed (database1), corresponding DB2 record changed (database2). Replication 1-2 overwrites DB2. Next replication 2-1 will made dummy DB1 replication because DB2 is overwritten. Result changes made to DB2 disappears.


Q: How do you meen: "Result changes made to DB2 disappears"? You mean value for DB2 is overwritten by DB1? That's ok.

But for offline sync, how do I set it up? For the master, only generate triggers etc for source db and make dummy db? And for target, make dummy source and generate for group/target db? Do I understand it right that it syncs on the db numbers? So for source a dummy 2, and target a dummy db1? (for an one way sync, for 2way the same principle?)


A: Overwrite problem:

Database 1Database 2Note
R1R1;
R1aR1b; changed on both sides
R1aR1a; replication 1-2
R1aR1a; replication 2-1

or

Database 1Database 2Note
R1bR1b; replication 2-1
R1bR1b; replication 1-2

More correct should be log an conflict error.

I don't know what you mean as Dummy database. In offline replication does exist source and target dbs (probably the same when starting). Create system objects (sch1) for source (DB1)(tables, triggers and access rights) and for target (DB2)(sch1) (rights and some tables). For opposite direction create sysobj for source (DB2) (sch2) and for target (DB1).

You must run pair of repl servers for each schema in offline replication.

Flow:

  • Sch1-db1 replserver reads changes in db1 and prepares package and put it to shared media
  • sch1-db2 replserver read package from shared media and writes changes to db2, put some acknowledges to shared
  • sch1-db1 read acknowledges etc.

the same for sch2

One replserver can serve more THE SAME databases in group. But I think is not your case. It can also "replicate" to plain SQL script (good for incremental backup and replication to different kind of SQL database).


Q: What I meant with "dummy" database: I have 2 seperate databases on 2 servers. With no direct connection. How can I configure a target database, if I can't reach it? Same problem with target: it can't reach the source.


A: For installation you must of course reach target database to prepare system objects and machine (ibreplserver). Copy configuration database to 2nd machine as well. But you don't need BOTH source AND target databases online in one time from one spot.

You can make setup the config databases have the same content (easier maintanace if you made changes in future).


Q: Thats what I meant for configuration:

  • install ibreplserver on DB1
  • config replication options**
  • prepare for logging
  • install ibreplserver on DB2
  • copy config db
  • prepare for logging

**But then I have to make a "dummy" database connection to the target db, in the config db.

A: Correct, you write config options to "dummy" databases. But it's just field in config database, connection is not used (established) on this side.