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);
}
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);
}
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();
}
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;
}
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);
}
Aggregations