We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Mirroring and syncing two system

Hi All. Hope this post find you well! I have a topic I want to discuss with you. I have a ticketing system running online and I need to mirror it behind a network: the users behind the network should work on the system mirrored, the users online with the master. But the two systems need to be syncronized in a safe way, not with mysql replication (because they work concurrently, there are to much table relations). Have you ever managed a similar scenario with phalcon?

So you need both online and network users to work on 2 separate databases that sync to each other? That seems needlessly complex - why not have them use the same database? I could be missing something of course.

I believe it's possible to set up 2 direction replication, with each server being both a master to and slave of the other. I've never done this though.

If this is a performance issue, then I think the usual solution is not to create a separate database, but to make the single database more performant. Stuff like stored procedures or clustering/sharding.

edited Jan '19

For such thing you'd need external tools like Percona toolkit and to use bidirectional sync.

pt-table-sync does one-way and bidirectional synchronization of table data. It does not synchronize table structures, indexes, or any other schema objects.

More info: https://www.percona.com/doc/percona-toolkit/LATEST/pt-table-sync.html#bidirectional-syncing

But keep in mind that relational databases are not designed with such things in mind. So there's always a trade off.

Bottomline is your least concernt is Phalcn (middle layer) here. Your primary concern is RDBMS.