Search in sources :

Example 1 with DcMeta

use of com.ctrip.xpipe.redis.core.entity.DcMeta in project x-pipe by ctripcorp.

the class ManualDcStarter method stopDc1.

@Test
public void stopDc1() throws ExecuteException, IOException {
    DcMeta dcMeta = getDcMeta(getAndSetDc(1));
    stopDc(dcMeta);
}
Also used : DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta) Test(org.junit.Test) AbstractMultiDcTest(com.ctrip.xpipe.redis.integratedtest.full.multidc.AbstractMultiDcTest)

Example 2 with DcMeta

use of com.ctrip.xpipe.redis.core.entity.DcMeta in project x-pipe by ctripcorp.

the class AbstractKeeperIntegratedSingleDc method initResource.

private void initResource() throws Exception {
    DcMeta dcMeta = getDcMeta();
    metaService = createMetaService(dcMeta.getMetaServers());
    leaderElectorManager = createLeaderElectorManager(dcMeta);
}
Also used : DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta)

Example 3 with DcMeta

use of com.ctrip.xpipe.redis.core.entity.DcMeta in project x-pipe by ctripcorp.

the class BaseSampleMonitor method generatePlan.

@Override
public Collection<BaseSamplePlan<T>> generatePlan(List<DcMeta> dcMetas) {
    Map<Pair<String, String>, BaseSamplePlan<T>> plans = new HashMap<>();
    for (DcMeta dcMeta : dcMetas) {
        for (ClusterMeta clusterMeta : dcMeta.getClusters().values()) {
            if (!addCluster(dcMeta.getId(), clusterMeta)) {
                continue;
            }
            for (ShardMeta shardMeta : clusterMeta.getShards().values()) {
                Pair<String, String> cs = new Pair<>(clusterMeta.getId(), shardMeta.getId());
                BaseSamplePlan<T> plan = plans.get(cs);
                if (plan == null) {
                    plan = createPlan(dcMeta.getId(), clusterMeta.getId(), shardMeta.getId());
                    plans.put(cs, plan);
                }
                for (RedisMeta redisMeta : shardMeta.getRedises()) {
                    log.debug("[generatePlan]{}", redisMeta.desc());
                    addRedis(plan, dcMeta.getId(), redisMeta);
                }
                if (plan.isEmpty()) {
                    plans.remove(cs);
                }
            }
        }
    }
    return plans.values();
}
Also used : ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta) ShardMeta(com.ctrip.xpipe.redis.core.entity.ShardMeta) RedisMeta(com.ctrip.xpipe.redis.core.entity.RedisMeta) Pair(com.ctrip.xpipe.tuple.Pair)

Example 4 with DcMeta

use of com.ctrip.xpipe.redis.core.entity.DcMeta 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 5 with DcMeta

use of com.ctrip.xpipe.redis.core.entity.DcMeta in project x-pipe by ctripcorp.

the class AbstractMetaServerContextTest method randomClusterMeta.

protected ClusterMeta randomClusterMeta() {
    DcMeta dcMeta = getDcMeta(dc);
    ClusterMeta clusterMeta = (ClusterMeta) dcMeta.getClusters().values().toArray()[0];
    return MetaClone.clone(clusterMeta);
}
Also used : ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta)

Aggregations

DcMeta (com.ctrip.xpipe.redis.core.entity.DcMeta)31 Test (org.junit.Test)19 DirtiesContext (org.springframework.test.annotation.DirtiesContext)7 AbstractMigrationTest (com.ctrip.xpipe.redis.console.migration.AbstractMigrationTest)6 ClusterTbl (com.ctrip.xpipe.redis.console.model.ClusterTbl)5 ClusterMeta (com.ctrip.xpipe.redis.core.entity.ClusterMeta)5 XpipeMeta (com.ctrip.xpipe.redis.core.entity.XpipeMeta)5 AbstractMultiDcTest (com.ctrip.xpipe.redis.integratedtest.full.multidc.AbstractMultiDcTest)5 MigrationClusterTbl (com.ctrip.xpipe.redis.console.model.MigrationClusterTbl)4 AbstractRedisTest (com.ctrip.xpipe.redis.core.AbstractRedisTest)4 ShardMeta (com.ctrip.xpipe.redis.core.entity.ShardMeta)4 LinkedList (java.util.LinkedList)4 RedisMeta (com.ctrip.xpipe.redis.core.entity.RedisMeta)3 HostPort (com.ctrip.xpipe.endpoint.HostPort)2 LeaderElectorManager (com.ctrip.xpipe.api.cluster.LeaderElectorManager)1 Codec (com.ctrip.xpipe.api.codec.Codec)1 JsonCodec (com.ctrip.xpipe.codec.JsonCodec)1 ParallelCommandChain (com.ctrip.xpipe.command.ParallelCommandChain)1 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)1 ServerException (com.ctrip.xpipe.redis.console.exception.ServerException)1