当前位置: 首页>>代码示例>>Java>>正文


Java ReplicationConnectionGroupManager.addSlaveHost方法代码示例

本文整理汇总了Java中com.mysql.jdbc.ReplicationConnectionGroupManager.addSlaveHost方法的典型用法代码示例。如果您正苦于以下问题:Java ReplicationConnectionGroupManager.addSlaveHost方法的具体用法?Java ReplicationConnectionGroupManager.addSlaveHost怎么用?Java ReplicationConnectionGroupManager.addSlaveHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mysql.jdbc.ReplicationConnectionGroupManager的用法示例。


在下文中一共展示了ReplicationConnectionGroupManager.addSlaveHost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReplicationConnectionMemory

import com.mysql.jdbc.ReplicationConnectionGroupManager; //导入方法依赖的package包/类
public void testReplicationConnectionMemory() throws Exception {
    Properties props = new Properties();
    props.setProperty("retriesAllDown", "3");
    String replicationGroup = "memoryGroup";
    props.setProperty("replicationConnectionGroup", replicationGroup);

    Set<MockConnectionConfiguration> configs = new HashSet<MockConnectionConfiguration>();
    MockConnectionConfiguration first = new MockConnectionConfiguration("first", "slave", null, false);
    MockConnectionConfiguration second = new MockConnectionConfiguration("second", "master", null, false);
    MockConnectionConfiguration third = new MockConnectionConfiguration("third", "slave", null, false);

    configs.add(first);
    configs.add(second);
    configs.add(third);

    ReplicationConnection conn2 = this.getUnreliableReplicationConnection(configs, props);

    ReplicationConnectionGroupManager.promoteSlaveToMaster(replicationGroup, first.getAddress());
    ReplicationConnectionGroupManager.removeMasterHost(replicationGroup, second.getAddress());
    ReplicationConnectionGroupManager.addSlaveHost(replicationGroup, second.getAddress());

    conn2.setReadOnly(false);

    assertFalse(conn2.isReadOnly());
    assertTrue(conn2.isMasterConnection());
    assertTrue(conn2.isHostMaster(first.getAddress()));
    assertTrue(conn2.isHostSlave(second.getAddress()));
    assertTrue(conn2.isHostSlave(third.getAddress()));

    // make sure state changes made are reflected in new connections:

    ReplicationConnection conn3 = this.getUnreliableReplicationConnection(configs, props);

    conn3.setReadOnly(false);

    assertFalse(conn3.isReadOnly());
    assertTrue(conn3.isMasterConnection());
    assertTrue(conn3.isHostMaster(first.getAddress()));
    assertTrue(conn3.isHostSlave(second.getAddress()));
    assertTrue(conn3.isHostSlave(third.getAddress()));

}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:43,代码来源:ConnectionRegressionTest.java

示例2: addSlaveHost

import com.mysql.jdbc.ReplicationConnectionGroupManager; //导入方法依赖的package包/类
public void addSlaveHost(String groupFilter, String host) throws SQLException {
    ReplicationConnectionGroupManager.addSlaveHost(groupFilter, host);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:ReplicationGroupManager.java

示例3: testReplicationConnectionMemory

import com.mysql.jdbc.ReplicationConnectionGroupManager; //导入方法依赖的package包/类
public void testReplicationConnectionMemory() throws Exception {
	Properties props = new Properties();
	props.setProperty("retriesAllDown", "3");
	String replicationGroup = "memoryGroup";
	props.setProperty("replicationConnectionGroup", replicationGroup);

	Set<MockConnectionConfiguration> configs = new HashSet<MockConnectionConfiguration>();
	MockConnectionConfiguration first = new MockConnectionConfiguration("first", "slave", null, false);
	MockConnectionConfiguration second = new MockConnectionConfiguration("second", "master", null, false);
	MockConnectionConfiguration third = new MockConnectionConfiguration("third", "slave", null, false);

	configs.add(first);
	configs.add(second);
	configs.add(third);

	ReplicationConnection conn2 = this
			.getUnreliableReplicationConnection(configs, props);


	ReplicationConnectionGroupManager.promoteSlaveToMaster(replicationGroup, first.getAddress());
	ReplicationConnectionGroupManager.removeMasterHost(replicationGroup, second.getAddress());
	ReplicationConnectionGroupManager.addSlaveHost(replicationGroup, second.getAddress());

	conn2.setReadOnly(false);

	assertFalse(conn2.isReadOnly());
	assertTrue(conn2.isMasterConnection());
	assertTrue(conn2.isHostMaster(first.getAddress()));
	assertTrue(conn2.isHostSlave(second.getAddress()));
	assertTrue(conn2.isHostSlave(third.getAddress()));


	// make sure state changes made are reflected in new connections:

	ReplicationConnection conn3 = this
			.getUnreliableReplicationConnection(configs, props);


	conn3.setReadOnly(false);

	assertFalse(conn3.isReadOnly());
	assertTrue(conn3.isMasterConnection());
	assertTrue(conn3.isHostMaster(first.getAddress()));
	assertTrue(conn3.isHostSlave(second.getAddress()));
	assertTrue(conn3.isHostSlave(third.getAddress()));


}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:49,代码来源:ConnectionRegressionTest.java

示例4: addSlaveHost

import com.mysql.jdbc.ReplicationConnectionGroupManager; //导入方法依赖的package包/类
public void addSlaveHost(String groupFilter, String host) throws SQLException {
	ReplicationConnectionGroupManager.addSlaveHost(groupFilter, host);
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:4,代码来源:ReplicationGroupManager.java


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