• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BinaryLogClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.shyiko.mysql.binlog.BinaryLogClient的典型用法代码示例。如果您正苦于以下问题:Java BinaryLogClient类的具体用法?Java BinaryLogClient怎么用?Java BinaryLogClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BinaryLogClient类属于com.github.shyiko.mysql.binlog包,在下文中一共展示了BinaryLogClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: postConstruct

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@PostConstruct
public void postConstruct() throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException {

    log.debug("Create BinaryLogClient {}@{}:{}", mysqlUser, mysqlHost, mysqlPort);
    client = new BinaryLogClient(mysqlHost, mysqlPort, mysqlUser, mysqlPassword);
    log.debug("Getting columns names.");
    getColumnName();
    log.debug("Activate JMXBean");

    ObjectName objectName = new ObjectName("mysql.binlog:type=BinaryLogClient");
    mBeanServer.registerMBean(client, objectName);

    BinaryLogClientStatistics stats = new BinaryLogClientStatistics(client);
    ObjectName statsObjectName = new ObjectName("mysql.binlog:type=BinaryLogClientStatistics");
    mBeanServer.registerMBean(stats, statsObjectName);
}
 
开发者ID:juanwolf,项目名称:mysql-binlog-replicator,代码行数:17,代码来源:MysqlBinLogService.java


示例2: BinlogClientImpl

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public BinlogClientImpl(Vertx vertx, BinlogClientOptions options) {
  this.vertx = vertx;
  this.context = vertx.getOrCreateContext();
  this.host = options.getHost();
  this.port = options.getPort();
  this.connectTimeout = options.getConnectTimeout();
  this.sqlClient = MySQLClient.createNonShared(vertx,
    new JsonObject()
      .put("host", options.getHost())
      .put("port", options.getPort())
      .put("database", "information_schema")
      .put("maxPoolSize", 1)
      .put("username", options.getUsername())
      .put("password",
          "".equals(options.getPassword()) ?
            null : options.getPassword())
  );
  dispatcher = new EventDispatcher(vertx,
    new SchemaResolver(sqlClient));
  client = new BinaryLogClient(
    host, port,
    options.getUsername(),
    Optional.ofNullable(
      options.getPassword()
    ).orElse("")
  );
  if (options.getFilename() != null) {
    client.setBinlogFilename(options.getFilename());
  }
  if (options.getPosition() != -1) {
    client.setBinlogPosition(options.getPosition());
  }
  client.setHeartbeatInterval(options.getHeartbeatInterval());
  client.setKeepAlive(options.isKeepAlive());
  client.setKeepAliveInterval(options.getKeepAliveInterval());
  client.registerEventListener(this::handle);
}
 
开发者ID:guoyu511,项目名称:vertx-mysql-binlog-client,代码行数:38,代码来源:BinlogClientImpl.java


示例3: onCommunicationFailure

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onCommunicationFailure(BinaryLogClient client, Exception ex) {
    // TODO Auto-generated method stub
    if (ex.getMessage()
            .equals("1236 - Could not find first log file name in binary log index file")) {
        // The binary log has been rotate out from the master, so we can't
        // reconnect to it. Shutdown the listener, and tell the operator
        // that we need to rebootstrap.
        System.out.println(String.format("Binlog %s/%d is no longer available on the master. Need to re-bootstrap.", 
                client.getBinlogFilename(), client.getBinlogPosition()));
        this.failureReason = Reason.BINLOG_NOT_AVAILABLE;
    }
}
 
开发者ID:TiVo,项目名称:wombat,代码行数:14,代码来源:ConnectionLifecycleListener.java


示例4: BinlogEventListener

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public BinlogEventListener(BinaryLogClient binaryLogClient, KafkaProducer kafkaProducer) {
	this.binaryLogClient = binaryLogClient;
	this.tableMap = new HashMap<Long, Table>();
	this.kafkaProducer = kafkaProducer;
	this.gtidSet = binaryLogClient.getGtidSet();

	this.replicateTables = new HashSet<String>();
	
	for(String fqTable: StringUtil.split(App.config.getProperty("replicateTables"), ',')) {
		String cleanFqTable = fqTable.trim();
		
		if(cleanFqTable.length() > 0)
			replicateTables.add(cleanFqTable);
	}
}
 
开发者ID:mrkamel,项目名称:replicaza,代码行数:16,代码来源:BinlogEventListener.java


示例5: takeLeadership

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public void takeLeadership(CuratorFramework curatorFramework) throws InterruptedException {
	try {
		BinaryLogClient binaryLogClient = new BinaryLogClient(
	   		App.config.getProperty("mysql.host"),
	   		new Integer(App.config.getProperty("mysql.port")),
	   		App.config.getProperty("mysql.user"),
	   		App.config.getProperty("mysql.pass")
	   	);

    	GtidSync gtidSync = new GtidSync("/replicaza_gtid", curatorFramework.getZookeeperClient());
		gtidSync.start();
		
	   	binaryLogClient.setKeepAlive(false);
	   	binaryLogClient.setGtidSet(gtidSync.getGtidSet());
	   	
	   	KafkaProducer kafkaProducer = new KafkaProducer(
	   		App.config.getProperty("kafka.brokers"),
	   		new Integer(App.config.getProperty("kafka.requiredAcks")),
	   		gtidSync
	   	);
	   	
	   	kafkaProducer.start();

	   	binaryLogClient.registerEventListener(new BinlogEventListener(binaryLogClient, kafkaProducer));
	   	binaryLogClient.connect();
	} catch(Exception e) {
		e.printStackTrace();
	} finally {	
		// Sleep some time, but then give someone else a chance to become leader,
		// because someone else could have better connectivity
   		
		Thread.sleep(5000);
		
		System.exit(-1);
	}
}
 
开发者ID:mrkamel,项目名称:replicaza,代码行数:37,代码来源:LeaderListener.java


示例6: isRunning

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public boolean isRunning() {
    if (BINLOG_EVENT_PARSER_PROVIDER_CODE == BinlogEventParserProviderCode.OR) {
        return ((OpenReplicator)binlogEventParserProvider).isRunning();
    }
    else { // if (BINLOG_EVENT_PARSER_PROVIDER_CODE == BinlogEventParserProviderCode.OR) {
        return  ((BinaryLogClient)binlogEventParserProvider).isConnected();
    }
}
 
开发者ID:mysql-time-machine,项目名称:replicator,代码行数:9,代码来源:BinlogEventProducer.java


示例7: stop

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public void stop(long timeout, TimeUnit unit) throws Exception {
    if (BINLOG_EVENT_PARSER_PROVIDER_CODE == BinlogEventParserProviderCode.OR) {
        stopOpenReplicator((OpenReplicator)binlogEventParserProvider,  timeout, unit);
    }
    else {
        stopBinaryLogClient((BinaryLogClient)binlogEventParserProvider,timeout, unit);
    }
}
 
开发者ID:mysql-time-machine,项目名称:replicator,代码行数:9,代码来源:BinlogEventProducer.java


示例8: start

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public void start() throws Exception {
    if (binlogEventParserProvider instanceof OpenReplicator) {
        startOpenReplicator((OpenReplicator) binlogEventParserProvider);
    }
    else if (binlogEventParserProvider instanceof BinaryLogClient) {
        startBinaryLogClient((BinaryLogClient) binlogEventParserProvider);
    }
    else {
        throw new Exception("Unsupported parser exception");
    }
}
 
开发者ID:mysql-time-machine,项目名称:replicator,代码行数:12,代码来源:BinlogEventProducer.java


示例9: run

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void run() {
	client = new BinaryLogClient(host, port, user, password);
	// TODO: GTID support
	client.setBinlogFilename(position.getFilename());
	client.setBinlogPosition(position.getOffset());
	client.registerEventListener(this);
	try {
		client.connect();
	} catch (IOException e) {
		e.printStackTrace();
		System.exit(1);
	}
}
 
开发者ID:frew,项目名称:chute,代码行数:15,代码来源:MySqlIterativeImporter.java


示例10: createBinaryLogClient

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
private BinaryLogClient createBinaryLogClient() {
  BinaryLogClient binLogClient = new BinaryLogClient(
      getConfig().hostname,
      port,
      getConfig().username,
      getConfig().password
  );
  if (getConfig().useSsl) {
    binLogClient.setSSLMode(SSLMode.REQUIRED);
  } else {
    binLogClient.setSSLMode(SSLMode.DISABLED);
  }
  binLogClient.setServerId(serverId);
  return binLogClient;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:16,代码来源:MysqlSource.java


示例11: getClient

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public BinaryLogClient getClient() {
  return client;
}
 
开发者ID:guoyu511,项目名称:vertx-mysql-binlog-client,代码行数:4,代码来源:BinlogClientImpl.java


示例12: onConnect

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onConnect(BinaryLogClient client) {
    this.binlogFilename = client.getBinlogFilename();
    this.binlogClient = client;
}
 
开发者ID:TiVo,项目名称:wombat,代码行数:6,代码来源:EventHandler.java


示例13: onCommunicationFailure

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onCommunicationFailure(BinaryLogClient client, Exception ex) {
}
 
开发者ID:TiVo,项目名称:wombat,代码行数:4,代码来源:EventHandler.java


示例14: onEventDeserializationFailure

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onEventDeserializationFailure(BinaryLogClient client,
        Exception ex) {
    // TODO Auto-generated method stub
    
}
 
开发者ID:TiVo,项目名称:wombat,代码行数:7,代码来源:EventHandler.java


示例15: onDisconnect

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onDisconnect(BinaryLogClient client) {
    // TODO Auto-generated method stub
    
}
 
开发者ID:TiVo,项目名称:wombat,代码行数:6,代码来源:EventHandler.java


示例16: onConnect

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onConnect(BinaryLogClient client) {
    // TODO Auto-generated method stub

}
 
开发者ID:TiVo,项目名称:wombat,代码行数:6,代码来源:ConnectionLifecycleListener.java


示例17: onEventDeserializationFailure

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onEventDeserializationFailure(BinaryLogClient client,
        Exception ex) {
    // TODO Auto-generated method stub

}
 
开发者ID:TiVo,项目名称:wombat,代码行数:7,代码来源:ConnectionLifecycleListener.java


示例18: onDisconnect

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
@Override
public void onDisconnect(BinaryLogClient client) {
    // TODO Auto-generated method stub
}
 
开发者ID:TiVo,项目名称:wombat,代码行数:5,代码来源:ConnectionLifecycleListener.java


示例19: createBinaryLogClient

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
private BinaryLogClient createBinaryLogClient() {
	return new BinaryLogClient("127.0.0.1", 3306, "root", "");
}
 
开发者ID:mrkamel,项目名称:replicaza,代码行数:4,代码来源:BinlogEventListenerTest.java


示例20: stopBinaryLogClient

import com.github.shyiko.mysql.binlog.BinaryLogClient; //导入依赖的package包/类
public void stopBinaryLogClient (BinaryLogClient binaryLogClient, long timeout, TimeUnit unit) throws Exception {
    binaryLogClient.disconnect();
}
 
开发者ID:mysql-time-machine,项目名称:replicator,代码行数:4,代码来源:BinlogEventProducer.java



注:本文中的com.github.shyiko.mysql.binlog.BinaryLogClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ZKProcedureCoordinatorRpcs类代码示例发布时间:2022-05-22
下一篇:
Java MetadataXpp3Reader类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap