Code Monkey home page Code Monkey logo

Comments (3)

wangengzheng avatar wangengzheng commented on May 24, 2024
 var client = new BinlogClient(options =>
            {
                options.Hostname = _syncSetting.Hostname;
                options.Database = _syncSetting.Database;
                options.ServerId=_syncSetting.ServerId;
                options.Port = _syncSetting.Port;
                options.Username =_syncSetting.UserName;
                options.Password = _syncSetting.Password;
                options.SslMode = MySqlCdc.Constants.SslMode.REQUIRE;
                options.HeartbeatInterval = TimeSpan.FromSeconds(30);
                options.Blocking = true;
                options.Binlog = BinlogOptions.FromEnd();
                
            });

 await foreach (var binlogEvent in client.Replicate(stoppingToken))
  {
      Log.Information("{@event}",binlogEvent);
  }

Similar code

from mysqlcdc.

rusuly avatar rusuly commented on May 24, 2024

Hi @wangengzheng,

I'm on a vacation and can't test the scenario you described but I think BinlogClient should support the case.
MySQL supports multiple replicas of the same master server so multiple BinlogClients should work.
In fact, they need to have different ServerId. The ServerId must be unique for each replica including BinlogClient

Try to run two BinlogClient in two different .NET threads(using Task.Run) and see if your problem is solved.
Maybe there is some kind of deadlock in your code, also the exception happened to me once when the master server was too busy(processed multiple insert requests).

from mysqlcdc.

wangengzheng avatar wangengzheng commented on May 24, 2024

Thank you so much for taking the time to reply.

I will try more examples.

MySQL supports multiple replicas of the same master server so multiple BinlogClients should work.
This information is very helpful to me. Thank you and wish you a pleasant journey

from mysqlcdc.

Related Issues (19)

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.