use of com.ctrip.xpipe.redis.core.entity.ClusterMeta in project x-pipe by ctripcorp.
the class MetaInfoChange method testChangeClusterKeeper.
@Test
public void testChangeClusterKeeper() throws IOException {
sleep(2000);
// change keeper
try {
ClusterMeta clusterMeta = getCluster(dc, clusterId);
changeClusterKeeper(clusterMeta);
metaServerConsoleService.clusterModified(clusterMeta.getId(), clusterMeta);
} catch (Exception e) {
logger.error("[testChangeClusterKeeper]", e);
}
waitForAnyKeyToExit();
}
use of com.ctrip.xpipe.redis.core.entity.ClusterMeta in project x-pipe by ctripcorp.
the class CurrentMetaTest method testChange.
@Test
public void testChange() {
ClusterMeta future = MetaClone.clone(clusterMeta);
String newShardId = randomString(100);
ShardMeta shardMeta = future.getShards().remove(shardId);
shardMeta.setId(newShardId);
future.addShard(shardMeta);
ClusterMetaComparator comparator = new ClusterMetaComparator(clusterMeta, future);
comparator.compare();
currentMeta.changeCluster(comparator);
Assert.assertFalse(currentMeta.hasShard(clusterId, shardId));
Assert.assertTrue(currentMeta.hasShard(clusterId, newShardId));
}
use of com.ctrip.xpipe.redis.core.entity.ClusterMeta in project x-pipe by ctripcorp.
the class KeeperContainerService method enrichKeeperMetaFromKeeperTransMeta.
private void enrichKeeperMetaFromKeeperTransMeta(KeeperMeta keeperMeta, KeeperTransMeta keeperTransMeta) {
ClusterMeta clusterMeta = new ClusterMeta(keeperTransMeta.getClusterId());
ShardMeta shardMeta = new ShardMeta(keeperTransMeta.getShardId());
shardMeta.setParent(clusterMeta);
keeperMeta.setParent(shardMeta);
}
use of com.ctrip.xpipe.redis.core.entity.ClusterMeta in project x-pipe by ctripcorp.
the class GeneratePlanTest method testGeneratePlan.
@Test
public void testGeneratePlan() {
List<DcMeta> dcMetas = Lists.newArrayList(new DcMeta("SHAJQ").addCluster(new ClusterMeta("cluster1").setActiveDc("SHAJQ").setBackupDcs("SHAOY").addShard(new ShardMeta("shard1"))), new DcMeta("SHAOY").addCluster(new ClusterMeta("cluster1").setActiveDc("SHAJQ").setBackupDcs("SHAOY").addShard(new ShardMeta("shard1"))));
Collection result = monitor.generatePlan(dcMetas);
Assert.assertEquals(0, result.size());
}
use of com.ctrip.xpipe.redis.core.entity.ClusterMeta in project x-pipe by ctripcorp.
the class ClientConfigMonitor method fromXPipe.
private CheckCluster fromXPipe(XpipeMeta xpipeMeta, String checkCluster) {
XpipeMetaManager xpm = new DefaultXpipeMetaManager(xpipeMeta);
CheckCluster result = new CheckCluster(checkCluster);
for (String dc : xpipeMeta.getDcs().keySet()) {
ClusterMeta clusterMeta = xpm.getClusterMeta(dc, checkCluster);
if (clusterMeta == null) {
continue;
}
for (ShardMeta shardMeta : clusterMeta.getShards().values()) {
CheckShard orShard = result.getOrCreate(shardMeta.getId());
shardMeta.getRedises().forEach(redis -> {
orShard.addRedis(new CheckRedis(redis.getIp(), redis.getPort(), dc));
});
}
}
return result;
}
Aggregations