类 ReplicationConnectionGroup
- java.lang.Object
-
- com.mysql.cj.jdbc.ha.ReplicationConnectionGroup
-
public class ReplicationConnectionGroup extends Object
Group of connection objects which can be configured as a group. This is used for promotion/demotion of replicas and sources in a replication configuration, and for exposing metrics around replication-aware connections.
-
-
方法概要
-
-
-
方法详细资料
-
getConnectionCount
public long getConnectionCount()
-
registerReplicationConnection
public long registerReplicationConnection(ReplicationConnection conn, List<String> localSourceList, List<String> localReplicaList)
-
getGroupName
public String getGroupName()
-
getSourceHosts
public Collection<String> getSourceHosts()
-
getMasterHosts
@Deprecated public Collection<String> getMasterHosts()
已过时。UsegetSourceHosts()instead.- 返回:
- source hosts
-
getReplicaHosts
public Collection<String> getReplicaHosts()
-
getSlaveHosts
@Deprecated public Collection<String> getSlaveHosts()
已过时。UsegetReplicaHosts()instead.- 返回:
- replica hosts
-
addReplicaHost
public void addReplicaHost(String hostPortPair) throws SQLException
Adds a host to the replicas hosts list. We can safely assume that if this host was added to the replicas list, then it must be added to each one of the replication connections from this group as well. Unnecessary calls toReplicationConnection.addReplicaHost(String)could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group already has this host in a replica role.- 参数:
hostPortPair- "host:port"- 抛出:
SQLException- if an error occurs
-
addSlaveHost
@Deprecated public void addSlaveHost(String hostPortPair) throws SQLException
已过时。UseaddReplicaHost(String)instead.- 参数:
hostPortPair- host:port- 抛出:
SQLException
-
handleCloseConnection
public void handleCloseConnection(ReplicationConnection conn)
-
removeReplicaHost
public void removeReplicaHost(String hostPortPair, boolean closeGently) throws SQLException
Removes a host from the replicas hosts list. We can safely assume that if this host was removed from the replicas list, then it must be removed from each one of the replication connections from this group as well. Unnecessary calls toReplicationConnection.removeReplica(String, boolean)could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group doesn't have this host in a replica role.- 参数:
hostPortPair- "host:port"closeGently- remove host when it's not in use- 抛出:
SQLException- if an error occurs
-
removeSlaveHost
@Deprecated public void removeSlaveHost(String hostPortPair, boolean closeGently) throws SQLException
已过时。UseremoveReplicaHost(String, boolean)instead.- 参数:
hostPortPair- host:portcloseGently- option- 抛出:
SQLException
-
promoteReplicaToSource
public void promoteReplicaToSource(String hostPortPair) throws SQLException
Promotes a replica host to source. We can safely assume that if this host was removed from the replicas list or added to the sources list, then the same host promotion must happen in each one of the replication connections from this group as well. Unnecessary calls toReplicationConnection.promoteReplicaToSource(String)could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group already has this host in a source role and not in replica role.- 参数:
hostPortPair- "host:port"- 抛出:
SQLException- if an error occurs
-
promoteSlaveToMaster
@Deprecated public void promoteSlaveToMaster(String hostPortPair) throws SQLException
已过时。UsepromoteReplicaToSource(String)instead.- 参数:
hostPortPair- host:port- 抛出:
SQLException
-
removeSourceHost
public void removeSourceHost(String hostPortPair) throws SQLException
Removes a host from the sources hosts list.- 参数:
hostPortPair- host:port- 抛出:
SQLException- if an error occurs
-
removeMasterHost
@Deprecated public void removeMasterHost(String hostPortPair) throws SQLException
已过时。UseremoveSourceHost(String)instead.- 参数:
hostPortPair- host:port- 抛出:
SQLException
-
removeSourceHost
public void removeSourceHost(String hostPortPair, boolean closeGently) throws SQLException
Removes a host from the sources hosts list. We can safely assume that if this host was removed from the sources list, then it must be removed from each one of the replication connections from this group as well. Unnecessary calls toReplicationConnection.removeSourceHost(String, boolean)could result in undesirable locking issues, assuming that this method is synchronized by nature. This is a no-op if the group doesn't have this host in a source role.- 参数:
hostPortPair- "host:port"closeGently- remove host when it's not in use- 抛出:
SQLException- if an error occurs
-
removeMasterHost
@Deprecated public void removeMasterHost(String hostPortPair, boolean closeGently) throws SQLException
已过时。UseremoveSourceHost(String, boolean)instead.- 参数:
hostPortPair- host:portcloseGently- option- 抛出:
SQLException
-
getConnectionCountWithHostAsReplica
public int getConnectionCountWithHostAsReplica(String hostPortPair)
-
getConnectionCountWithHostAsSlave
@Deprecated public int getConnectionCountWithHostAsSlave(String hostPortPair)
已过时。UsegetConnectionCountWithHostAsReplica(String)instead.- 参数:
hostPortPair- host:port- 返回:
- count
-
getConnectionCountWithHostAsSource
public int getConnectionCountWithHostAsSource(String hostPortPair)
-
getConnectionCountWithHostAsMaster
@Deprecated public int getConnectionCountWithHostAsMaster(String hostPortPair)
已过时。UsegetConnectionCountWithHostAsSource(String)instead.- 参数:
hostPortPair- host:port- 返回:
- count
-
getNumberOfReplicasAdded
public long getNumberOfReplicasAdded()
-
getNumberOfSlavesAdded
@Deprecated public long getNumberOfSlavesAdded()
已过时。UsegetNumberOfReplicasAdded()instead.- 返回:
- count
-
getNumberOfReplicasRemoved
public long getNumberOfReplicasRemoved()
-
getNumberOfSlavesRemoved
@Deprecated public long getNumberOfSlavesRemoved()
已过时。UsegetNumberOfReplicasRemoved()instead.- 返回:
- count
-
getNumberOfReplicaPromotions
public long getNumberOfReplicaPromotions()
-
getNumberOfSlavePromotions
@Deprecated public long getNumberOfSlavePromotions()
已过时。UsegetNumberOfReplicaPromotions()instead.- 返回:
- count
-
getTotalConnectionCount
public long getTotalConnectionCount()
-
getActiveConnectionCount
public long getActiveConnectionCount()
-
-