use of com.ctrip.xpipe.redis.console.resources.MasterNotFoundException in project x-pipe by ctripcorp.
the class DefaultSentinelCollector method collect.
@Override
public void collect(SentinelSample sentinelSample) {
Set<SentinelHello> hellos = sentinelSample.getHellos();
String clusterId = sentinelSample.getSamplePlan().getClusterId();
String shardId = sentinelSample.getSamplePlan().getShardId();
String sentinelMonitorName = metaCache.getSentinelMonitorName(clusterId, shardId);
Set<HostPort> masterDcSentinels = metaCache.getActiveDcSentinels(clusterId, shardId);
QuorumConfig quorumConfig = consoleConfig.getDefaultSentinelQuorumConfig();
HostPort masterAddr = null;
try {
masterAddr = metaCache.findMaster(clusterId, shardId);
} catch (MasterNotFoundException e) {
logger.error("[collect]" + e.getMessage(), e);
}
logger.debug("[collect]{},{},{}", clusterId, shardId, hellos);
// check delete
Set<SentinelHello> toDelete = checkAndDelete(sentinelMonitorName, masterDcSentinels, hellos, quorumConfig);
// checkReset
checkReset(clusterId, shardId, sentinelMonitorName, hellos);
// check add
Set<SentinelHello> toAdd = checkToAdd(clusterId, shardId, sentinelMonitorName, masterDcSentinels, hellos, masterAddr, quorumConfig);
doAction(toDelete, toAdd, quorumConfig);
}
Aggregations