com.github.shyiko.mysql.binlog.BinaryLogClient.setBinlogFilename()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中com.github.shyiko.mysql.binlog.BinaryLogClient.setBinlogFilename()方法的一些代码示例,展示了BinaryLogClient.setBinlogFilename()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BinaryLogClient.setBinlogFilename()方法的具体详情如下:
包路径:com.github.shyiko.mysql.binlog.BinaryLogClient
类名称:BinaryLogClient
方法名:setBinlogFilename

BinaryLogClient.setBinlogFilename介绍

暂无

代码示例

代码示例来源:origin: debezium/debezium

protected void rewindBinaryLogClient(BinlogPosition position) {
  try {
    if (isRunning()) {
      logger.debug("Rewinding binlog to position {}", position);
      client.disconnect();
      client.setBinlogFilename(position.getFilename());
      client.setBinlogPosition(position.getPosition());
      client.connect();
    }
  } catch (IOException e) {
    logger.error("Unexpected error when re-connecting to the MySQL binary log reader", e);
  }
}

代码示例来源:origin: apache/rocketmq-externals

private void checkConnection() throws Exception {
  if (!binaryLogClient.isConnected()) {
    BinlogPosition binlogPosition = replicator.getNextBinlogPosition();
    if (binlogPosition != null) {
      binaryLogClient.setBinlogFilename(binlogPosition.getBinlogFilename());
      binaryLogClient.setBinlogPosition(binlogPosition.getPosition());
    }
    binaryLogClient.connect(3000);
  }
}

代码示例来源:origin: apache/nifi

binlogClient.setBinlogFilename(currentBinlogFile);
if (currentBinlogPosition != DO_NOT_SET) {
  binlogClient.setBinlogPosition(currentBinlogPosition);

代码示例来源:origin: zendesk/maxwell

private void ensureReplicatorThread() throws Exception {
  checkCommErrors();
  if ( !client.isConnected() && !stopOnEOF ) {
    if (this.gtidPositioning) {
      // When using gtid positioning, reconnecting should take us to the top
      // of the gtid event.  We throw away any binlog position we have
      // (other than GTID) and bail out of getTransactionRows()
      LOGGER.warn("replicator stopped at position: {} -- restarting", client.getGtidSet());
      client.setBinlogFilename("");
      client.setBinlogPosition(4L);
      client.connect(5000);
      throw new ClientReconnectedException();
    } else {
      // standard binlog positioning is a lot easier; we can really reconnect anywhere
      // we like, so we don't have to bail out of the middle of an event.
      LOGGER.warn("replicator stopped at position: {} -- restarting", client.getBinlogFilename() + ":" + client.getBinlogPosition());
      client.connect(5000);
    }
  }
}

代码示例来源:origin: debezium/debezium

} else {
  client.setBinlogFilename(source.binlogFilename());
  client.setBinlogPosition(source.binlogPosition());
  gtidSet = new com.github.shyiko.mysql.binlog.GtidSet("");
client.setBinlogFilename(source.binlogFilename());
client.setBinlogPosition(source.binlogPosition());

代码示例来源:origin: debezium/debezium

@Ignore
@Test( expected = ServerException.class)
public void shouldFailToConnectToInvalidBinlogFile() throws Exception {
  Testing.Print.enable();
  startClient(client -> {
    client.setBinlogFilename("invalid-mysql-binlog.filename.000001");
  });
}

代码示例来源:origin: debezium/debezium

/**
 * Test case that is normally commented out since it is only useful to print out the DDL statements recorded by
 * the binlog during a MySQL server initialization and startup.
 * 
 * @throws Exception if there are problems
 */
@Ignore
@Test
public void shouldCaptureQueryEventData() throws Exception {
  // Testing.Print.enable();
  startClient(client -> {
    client.setBinlogFilename("mysql-bin.000001");
    client.setBinlogPosition(4);
  });
  counters.consumeAll(5, TimeUnit.SECONDS);
  List<QueryEventData> allQueryEvents = recordedEventData(QueryEventData.class, -1);
  allQueryEvents.forEach(event -> {
    String sql = event.getSql();
    if (sql.equalsIgnoreCase("BEGIN") || sql.equalsIgnoreCase("COMMIT")) return;
    System.out.println(event.getSql());
  });
}

代码示例来源:origin: debezium/debezium

@Ignore
@Test
public void shouldReadMultipleBinlogFiles() throws Exception {
  Testing.Print.enable();
  startClient(client -> {
    client.setBinlogFilename("mysql-bin.000001");
  });
  counters.consumeAll(20, TimeUnit.SECONDS);
}

代码示例来源:origin: apache/rocketmq-externals

public void start() throws Exception {
  initDataSource();
  binlogPositionManager = new BinlogPositionManager(config, dataSource);
  binlogPositionManager.initBeginPosition();
  schema = new Schema(dataSource);
  schema.load();
  eventListener = new EventListener(queue);
  binaryLogClient = new BinaryLogClient(config.mysqlAddr,
    config.mysqlPort,
    config.mysqlUsername,
    config.mysqlPassword);
  binaryLogClient.setBlocking(true);
  binaryLogClient.setServerId(1001);
  EventDeserializer eventDeserializer = new EventDeserializer();
  eventDeserializer.setCompatibilityMode(EventDeserializer.CompatibilityMode.DATE_AND_TIME_AS_LONG,
    EventDeserializer.CompatibilityMode.CHAR_AND_BINARY_AS_BYTE_ARRAY);
  binaryLogClient.setEventDeserializer(eventDeserializer);
  binaryLogClient.registerEventListener(eventListener);
  binaryLogClient.setBinlogFilename(binlogPositionManager.getBinlogFilename());
  binaryLogClient.setBinlogPosition(binlogPositionManager.getPosition());
  binaryLogClient.connect(3000);
  LOGGER.info("Started.");
  doProcess();
}

代码示例来源:origin: zendesk/maxwell

} else {
  LOGGER.info("Setting initial binlog pos to: " + startBinlog.getFile() + ":" + startBinlog.getOffset());
  this.client.setBinlogFilename(startBinlog.getFile());
  this.client.setBinlogPosition(startBinlog.getOffset());
  this.gtidPositioning = false;

代码示例来源:origin: org.apache.nifi/nifi-cdc-mysql-processors

binlogClient.setBinlogFilename(currentBinlogFile);
if (currentBinlogPosition != DO_NOT_SET) {
  binlogClient.setBinlogPosition(currentBinlogPosition);

代码示例来源:origin: mysql-time-machine/replicator

this.client.setBinlogFilename(checkpoint.getBinlog().getFilename());
this.client.setBinlogPosition(checkpoint.getBinlog().getPosition());

代码示例来源:origin: networknt/light-eventuate-4j

client.setBinlogFilename(bfo.getBinlogFilename());
client.setBinlogPosition(bfo.getOffset());

代码示例来源:origin: io.debezium/debezium-connector-mysql

@Ignore
@Test( expected = ServerException.class)
public void shouldFailToConnectToInvalidBinlogFile() throws Exception {
  Testing.Print.enable();
  startClient(client -> {
    client.setBinlogFilename("invalid-mysql-binlog.filename.000001");
  });
}

代码示例来源:origin: io.debezium/debezium-connector-mysql

/**
 * Test case that is normally commented out since it is only useful to print out the DDL statements recorded by
 * the binlog during a MySQL server initialization and startup.
 * 
 * @throws Exception if there are problems
 */
@Ignore
@Test
public void shouldCaptureQueryEventData() throws Exception {
  // Testing.Print.enable();
  startClient(client -> {
    client.setBinlogFilename("mysql-bin.000001");
    client.setBinlogPosition(4);
  });
  counters.consumeAll(5, TimeUnit.SECONDS);
  List<QueryEventData> allQueryEvents = recordedEventData(QueryEventData.class, -1);
  allQueryEvents.forEach(event -> {
    String sql = event.getSql();
    if (sql.equalsIgnoreCase("BEGIN") || sql.equalsIgnoreCase("COMMIT")) return;
    System.out.println(event.getSql());
  });
}

代码示例来源:origin: eventuate-local/eventuate-local

client.setBinlogFilename(bfo.getBinlogFilename());
client.setBinlogPosition(bfo.getOffset());

代码示例来源:origin: io.debezium/debezium-connector-mysql

@Ignore
@Test
public void shouldReadMultipleBinlogFiles() throws Exception {
  Testing.Print.enable();
  startClient(client -> {
    client.setBinlogFilename("mysql-bin.000001");
  });
  counters.consumeAll(20, TimeUnit.SECONDS);
}

相关文章