Search in sources :

Example 6 with HostPort

use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.

the class VersionMonitor method addRedis.

@Override
protected void addRedis(BaseSamplePlan<VersionInstanceResult> plan, String dcId, RedisMeta redisMeta) {
    HostPort hostPort = new HostPort(redisMeta.getIp(), redisMeta.getPort());
    log.debug("[addRedis]{}", hostPort);
    plan.addRedis(dcId, redisMeta, new VersionInstanceResult());
}
Also used : HostPort(com.ctrip.xpipe.endpoint.HostPort)

Example 7 with HostPort

use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.

the class SentinelCollector4Keeper method collect.

@Override
public void collect(SentinelSample sentinelSample) {
    String clusterId = sentinelSample.getSamplePlan().getClusterId();
    String shardId = sentinelSample.getSamplePlan().getShardId();
    sentinelSample.getSamplePlan().getHostPort2SampleResult().forEach(((hostPort, instanceSentinelResult) -> {
        if (metaCache.inBackupDc(hostPort)) {
            ClusterShardHostPort entry = new ClusterShardHostPort(clusterId, shardId, hostPort);
            doCollect(entry, instanceSentinelResult);
        }
    }));
}
Also used : AlertManager(com.ctrip.xpipe.redis.console.alert.AlertManager) ClusterShardHostPort(com.ctrip.xpipe.endpoint.ClusterShardHostPort) Logger(org.slf4j.Logger) Sentinel(com.ctrip.xpipe.redis.core.protocal.pojo.Sentinel) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) Set(java.util.Set) SentinelManager(com.ctrip.xpipe.redis.console.redis.SentinelManager) ALERT_TYPE(com.ctrip.xpipe.redis.console.alert.ALERT_TYPE) Component(org.springframework.stereotype.Component) ObjectUtils(com.ctrip.xpipe.utils.ObjectUtils) StringUtil(com.ctrip.xpipe.utils.StringUtil) HostPort(com.ctrip.xpipe.endpoint.HostPort) MetaCache(com.ctrip.xpipe.redis.console.resources.MetaCache) ClusterShardHostPort(com.ctrip.xpipe.endpoint.ClusterShardHostPort)

Example 8 with HostPort

use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.

the class DefaultRedisSessionManager method getInUseRedises.

private Set<HostPort> getInUseRedises() {
    Set<HostPort> redisInUse = new HashSet<>();
    List<DcMeta> dcMetas = new LinkedList<>(metaCache.getXpipeMeta().getDcs().values());
    if (dcMetas.isEmpty())
        return null;
    for (DcMeta dcMeta : dcMetas) {
        if (dcMeta == null)
            break;
        for (ClusterMeta clusterMeta : dcMeta.getClusters().values()) {
            for (ShardMeta shardMeta : clusterMeta.getShards().values()) {
                for (RedisMeta redisMeta : shardMeta.getRedises()) {
                    redisInUse.add(new HostPort(redisMeta.getIp(), redisMeta.getPort()));
                }
            }
        }
    }
    return redisInUse;
}
Also used : ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta) HostPort(com.ctrip.xpipe.endpoint.HostPort) ShardMeta(com.ctrip.xpipe.redis.core.entity.ShardMeta) RedisMeta(com.ctrip.xpipe.redis.core.entity.RedisMeta) LinkedList(java.util.LinkedList) HashSet(java.util.HashSet)

Example 9 with HostPort

use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.

the class Sample method addInstanceSuccess.

@SuppressWarnings("unchecked")
public <C> void addInstanceSuccess(String host, int port, C context) {
    BaseInstanceResult<C> instanceResult = samplePlan.findInstanceResult(new HostPort(host, port));
    if (instanceResult != null && !instanceResult.isDone()) {
        instanceResult.success(System.nanoTime(), context);
        remainingRedisCount.decrementAndGet();
    }
}
Also used : HostPort(com.ctrip.xpipe.endpoint.HostPort)

Example 10 with HostPort

use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.

the class Sample method addInstanceFail.

public <C> void addInstanceFail(String host, int port, Throwable th) {
    BaseInstanceResult<C> instanceResult = samplePlan.findInstanceResult(new HostPort(host, port));
    if (instanceResult != null && !instanceResult.isDone()) {
        instanceResult.fail(System.nanoTime(), th);
        remainingRedisCount.decrementAndGet();
    }
}
Also used : HostPort(com.ctrip.xpipe.endpoint.HostPort)

Aggregations

HostPort (com.ctrip.xpipe.endpoint.HostPort)79 Test (org.junit.Test)31 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)7 LinkedList (java.util.LinkedList)7 ALERT_TYPE (com.ctrip.xpipe.redis.console.alert.ALERT_TYPE)6 MasterInfo (com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo)6 AbstractMetaServerTest (com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)6 ClusterShardHostPort (com.ctrip.xpipe.endpoint.ClusterShardHostPort)5 HashSet (java.util.HashSet)5 List (java.util.List)5 Map (java.util.Map)5 RedisConf (com.ctrip.xpipe.redis.console.health.redisconf.RedisConf)4 MasterNotFoundException (com.ctrip.xpipe.redis.console.resources.MasterNotFoundException)4 XpipeMetaManager (com.ctrip.xpipe.redis.core.meta.XpipeMetaManager)4 Set (java.util.Set)4 AbstractConsoleTest (com.ctrip.xpipe.redis.console.AbstractConsoleTest)3 AlertEntity (com.ctrip.xpipe.redis.console.alert.AlertEntity)3 AlertManager (com.ctrip.xpipe.redis.console.alert.AlertManager)3 DefaultRedisSessionManager (com.ctrip.xpipe.redis.console.health.DefaultRedisSessionManager)3 ClusterListClusterModel (com.ctrip.xpipe.redis.console.model.consoleportal.ClusterListClusterModel)3