public class ClusterHeartBeat extends Object
| Modifier and Type | Field and Description |
|---|---|
static Map<HostSpec,Set<Properties>> |
CLUSTER_PROPERTIES |
| Constructor and Description |
|---|
ClusterHeartBeat() |
| Modifier and Type | Method and Description |
|---|---|
void |
addClusterNode(HostSpec hostSpecs,
HostSpec... value)
Perform cache maintenance on cluster nodes connected to hosts
|
void |
addNodeRelationship(HostSpec key,
HostSpec[] value,
Properties properties)
Adding Cluster Information
|
void |
addProperties(HostSpec hostSpec,
Set<Properties> properties) |
void |
cacheProcess(HostSpec hostSpec,
Set<HostSpec> slaves,
Set<Properties> props,
Integer frequency)
Post-processing after the primary node fails
|
void |
clear() |
HostSpec |
findMasterNode(Set<HostSpec> hostSpecSet,
Set<Properties> properties)
Locate the host on the standby computer
|
Map<HostSpec,Set<HostSpec>> |
getClusterRelationship() |
Set<HostSpec> |
getClusterSalveNode(HostSpec hostSpec)
Get the cluster slave node
|
Set<Properties> |
getProperties(HostSpec hostSpec)
get parsed/defaulted connection properties
|
QueryExecutor |
getQueryExecutor(HostSpec hostSpec,
Set<Properties> propSet)
the node probes the activity by reflecting the tryConnect() method.
|
void |
initPeriodTime() |
void |
masterNodeProbe()
heartbeat task thread.
|
boolean |
nodeRoleIsMaster(QueryExecutor queryExecutor)
Check whether the node is the primary node
|
void |
removeClusterNode(HostSpec key,
HostSpec newKey,
Set<HostSpec> slaves)
Update the cluster node relationship
|
void |
removeProperties(HostSpec hostSpec,
Properties properties) |
void |
updateDetection() |
public static final Map<HostSpec,Set<Properties>> CLUSTER_PROPERTIES
public void masterNodeProbe()
public void updateDetection()
public void initPeriodTime()
public Set<Properties> getProperties(HostSpec hostSpec)
hostSpec - ip and portpublic void addNodeRelationship(HostSpec key, HostSpec[] value, Properties properties)
key - mastervalue - secondary listproperties - the parsed/defaulted connection propertiespublic void addProperties(HostSpec hostSpec, Set<Properties> properties)
hostSpec - ip and portproperties - the parsed/defaulted connection propertiespublic void removeClusterNode(HostSpec key, HostSpec newKey, Set<HostSpec> slaves)
key - old masternewKey - new masterslaves - slaves setpublic void addClusterNode(HostSpec hostSpecs, HostSpec... value)
hostSpecs - the parsed/defaulted connection propertiesvalue - slaves setpublic Set<HostSpec> getClusterSalveNode(HostSpec hostSpec)
hostSpec - the parsed/defaulted connection propertiespublic void removeProperties(HostSpec hostSpec, Properties properties)
hostSpec - ip and portproperties - the parsed/defaulted connection propertiespublic void clear()
public QueryExecutor getQueryExecutor(HostSpec hostSpec, Set<Properties> propSet) throws SQLException
hostSpec - ip and port.propSet - the parsed/defaulted connection propertiesSQLException - new sql exceptionpublic boolean nodeRoleIsMaster(QueryExecutor queryExecutor)
queryExecutor - queryExectorpublic void cacheProcess(HostSpec hostSpec, Set<HostSpec> slaves, Set<Properties> props, Integer frequency)
hostSpec - master ip and portslaves - slaves setprops - the parsed/defaulted connection propertiespublic HostSpec findMasterNode(Set<HostSpec> hostSpecSet, Set<Properties> properties)
hostSpecSet - slaves setproperties - the parsed/defaulted connection propertiesCopyright © 2023 openGauss. All rights reserved.