use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class OuterClientServiceProcessor method quorumMarkInstanceDown.
private void quorumMarkInstanceDown(ClusterShardHostPort clusterShardHostPort) {
HostPort hostPort = clusterShardHostPort.getHostPort();
List<HEALTH_STATE> health_states = consoleServiceManager.allHealthStatus(hostPort.getHost(), hostPort.getPort());
logger.info("[quorumMarkInstanceDown]{}, {}", clusterShardHostPort, health_states);
boolean quorum = consoleServiceManager.quorumSatisfy(health_states, (state) -> state == HEALTH_STATE.UNHEALTHY || state == HEALTH_STATE.DOWN);
if (quorum) {
finalStateSetterManager.set(clusterShardHostPort, false);
} else {
logger.info("[quorumMarkInstanceDown][quorum fail]{}, {}", clusterShardHostPort, quorum);
alertManager.alert(clusterShardHostPort.getClusterName(), clusterShardHostPort.getShardName(), hostPort, ALERT_TYPE.QUORUM_DOWN_FAIL, hostPort.toString());
}
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class OuterClientServiceProcessor method masterUp.
private boolean masterUp(ClusterShardHostPort clusterShardHostPort) {
// master up
HostPort redisMaster = metaCache.findMasterInSameShard(clusterShardHostPort.getHostPort());
boolean masterUp = allMonitorCollector.getState(redisMaster) == HEALTH_STATE.UP;
if (!masterUp) {
logger.info("[masterUp][master down instance:{}, master:{}]", clusterShardHostPort, redisMaster);
}
return masterUp;
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class MetricDelayCollector method collect.
@Override
public void collect(DelaySampleResult result) {
try {
List<MetricData> data = new LinkedList<>();
for (Entry<HostPort, Long> entry : result.getSlaveHostPort2Delay().entrySet()) {
MetricData point = getPoint(entry.getKey(), entry.getValue(), result);
data.add(point);
}
HostPort masterHostPort = result.getMasterHostPort();
if (masterHostPort != null) {
MetricData point = getPoint(masterHostPort, result.getMasterDelayNanos(), result);
data.add(point);
}
proxy.writeBinMultiDataPoint(data);
} catch (Exception e) {
log.error("Error send metrics to metric", e);
}
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class DefaultBacklogActiveCollectorTest method analysisInfoReplication3.
@Test
public void analysisInfoReplication3() throws Exception {
doNothing().when(alertManager).alert(any(), any(), any(), any(), any());
Assert.assertNotNull(redisConfManager);
RedisConf redisConf = new RedisConf(new HostPort(), "", "");
redisConf.setXredisVersion("1.0.0");
redisConf.setRedisVersion("4.0.1");
when(redisConfManager.findOrCreateConfig("127.0.0.1", 6379)).thenReturn(redisConf);
collector.analysisInfoReplication("role:unkown\n" + "master_host:10.2.54.233\n" + "master_port:7381\n" + "master_link_status:up\n" + "master_last_io_seconds_ago:0\n" + "master_sync_in_progress:0\n" + "slave_repl_offset:1439009182\n" + "slave_priority:100\n" + "slave_read_only:1\n" + "connected_slaves:0\n" + "master_replid:204b8d599765dd3dead6faa089aeb77d9d8726f5\n" + "master_replid2:0000000000000000000000000000000000000000\n" + "master_repl_offset:1439009182\n" + "second_repl_offset:-1\n" + "repl_backlog_active:0\n" + "repl_backlog_size:104857600\n" + "repl_backlog_first_byte_offset:1340037212\n" + "repl_backlog_histlen:98971971", "cluster", "shard", new HostPort("127.0.0.1", 6379));
verify(alertManager, never()).alert(any(), any(), any(), any(), any());
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class DefaultBacklogActiveCollectorTest method analysisInfoReplication.
@Test
public void analysisInfoReplication() throws Exception {
doNothing().when(alertManager).alert(any(), any(), any(), any(), any());
Assert.assertNotNull(redisConfManager);
RedisConf redisConf = new RedisConf(new HostPort(), "", "");
redisConf.setXredisVersion("1.0.0");
redisConf.setRedisVersion("4.0.1");
when(redisConfManager.findOrCreateConfig("127.0.0.1", 6379)).thenReturn(redisConf);
collector.analysisInfoReplication("role:slave\n" + "master_host:10.2.54.233\n" + "master_port:7381\n" + "master_link_status:up\n" + "master_last_io_seconds_ago:0\n" + "master_sync_in_progress:0\n" + "slave_repl_offset:1439009182\n" + "slave_priority:100\n" + "slave_read_only:1\n" + "connected_slaves:0\n" + "master_replid:204b8d599765dd3dead6faa089aeb77d9d8726f5\n" + "master_replid2:0000000000000000000000000000000000000000\n" + "master_repl_offset:1439009182\n" + "second_repl_offset:-1\n" + "repl_backlog_active:0\n" + "repl_backlog_size:104857600\n" + "repl_backlog_first_byte_offset:1340037212\n" + "repl_backlog_histlen:98971971", "cluster", "shard", new HostPort("127.0.0.1", 6379));
verify(alertManager).alert(any(), any(), any(), any(), any());
}
Aggregations