Giter Site home page Giter Site logo

Comments (12)

rusuly avatar rusuly commented on May 16, 2024 1

also, be informed that BinlogClient doesn't support reconnecting right now. I need some time to think about how to implement keep-alive feature properly

from mysqlcdc.

rusuly avatar rusuly commented on May 16, 2024

Hi,
Currently, it doesn't.
You could use FromGtid() method for GTID-based replication but currently, it doesn't implement GtidSet

Are you talking about a simple master-slave replication cluster configured manually or a complex tool like Galera Cluster for master-master replication and automatic failover?

from mysqlcdc.

ElderJames avatar ElderJames commented on May 16, 2024

The second. I want to be highly available.

from mysqlcdc.

rusuly avatar rusuly commented on May 16, 2024

In theory, GTID is designed for replication with failovers and allows to support multi-master setup.
I am going to implement GtidSet for MySQL 5.6+ later this week or by the end of the month.
But I have no idea how to integrate it with custom coordination software like Galera Cluster.

from mysqlcdc.

rusuly avatar rusuly commented on May 16, 2024

Hi,
I'm working on the task(GtidSet for MySQL 5.6-8.0).
I think it will be ready in two days.
If you need MariaDB let me know(as the fork has different Gtid list implementation)

from mysqlcdc.

ElderJames avatar ElderJames commented on May 16, 2024

For now,I only use MySQL.
It would be very helpful if it supports GtidSet.

from mysqlcdc.

rusuly avatar rusuly commented on May 16, 2024

Sorry,
still working on the task

from mysqlcdc.

rusuly avatar rusuly commented on May 16, 2024

Hi again,
I just finished GtidSet.

To properly support cluster replication failover please make sure you understand:

So, BinlogClient keeps the current replication state in the State property and updates it on every transaction commit or rollback(see Q&A in the readme). It updates binlog filename, position and the GtidSet in Gtid mode. Think of BinlogClient as a slave whose @@gtid_executed is stored in State and updated when each transaction is replicated.

Note: In order to guarantee consistency, the State is updated only after your event callback was called and didn't throw an exception. Otherwise, your derived database(Elasticsearch, Redis) could end up in an inconsistent state.

In case of failover, you get the current position from State.GtidState and connect to the new master
using the position as the starting point in FromGtid.

And as I mentioned above, I have no idea how to integrate the library with orchestration software that performs failover & switchover automatically(like Galera, or other tools that elect the new master and tell other replicas to switch to it)

from mysqlcdc.

ElderJames avatar ElderJames commented on May 16, 2024

Excellent!
I have a question about whether the replication state of BinlogClient can be persisted directly so that BinlogClient can be restored to its previous state after being restarted.

from mysqlcdc.

rusuly avatar rusuly commented on May 16, 2024

yes, State.GtidState.ToString() constructs string representation that you can parse GtidSet.Parse()

from mysqlcdc.

ElderJames avatar ElderJames commented on May 16, 2024

Hi, you just said

the State is updated only after your event callback was called and didn't throw an exception.

Can I just assume that when I throw an exception in the callback, the replication will retry?

from mysqlcdc.

rusuly avatar rusuly commented on May 16, 2024

Hi,
Basically, this behavior is designed to retry replication from the last failed position.
But as I mentioned before, retry(keep-alive) is not implemented right now, you should manually call again ReplicateAsync. This way replication will restart from the last committed State (which was updated after last successful client callback).

from mysqlcdc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.