Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-134

Expose mysql binlog position via JMX


    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Critical Critical
    • 0.3.4, 0.4
    • 0.3.2
    • mysql-connector
    • None

      We are using debezium mysql connector in our company. We need to have a metric that will say how far "slave(debezium) is behind master".
      We could compare master binlog position and file with slave(debezium) position.
      Debezium is using https://github.com/shyiko/mysql-binlog-connector-java which have feature Exposing BinaryLogClient through JMX.
      Code example:

      MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
      BinaryLogClient binaryLogClient = ...
      ObjectName objectName = new ObjectName("mysql.binlog:type=BinaryLogClient");
      mBeanServer.registerMBean(binaryLogClient, objectName);
      // following bean accumulates various BinaryLogClient stats 
      // (e.g. number of disconnects, skipped events)
      BinaryLogClientStatistics stats = new BinaryLogClientStatistics(binaryLogClient);
      ObjectName statsObjectName = new ObjectName("mysql.binlog:type=BinaryLogClientStatistics");
      mBeanServer.registerMBean(stats, statsObjectName);

      It would be very useful to have this metric for monitoring purposes.

            rhauch Randall Hauch (Inactive)
            vhorodchuk Vitalii Horodchuk (Inactive)
            0 Vote for this issue
            3 Start watching this issue