use of com.ctrip.xpipe.api.cluster.LeaderElectorManager in project x-pipe by ctripcorp.
the class AbstractFullIntegrated method startDc.
protected void startDc(String dc) throws Exception {
logger.info(remarkableMessage("[startDc]{}"), dc);
DcMeta dcMeta = getXpipeMeta().getDcs().get(dc);
DcInfo dcInfo = dcs.get(dc);
if (dcMeta == null || dcInfo == null) {
throw new IllegalStateException("dc not found:" + dc);
}
DefaultFoundationService.setDataCenter(dc);
startZkServer(dcMeta.getZkServer());
startMetaServers(dcMeta);
MetaServerKeeperService metaService = createMetaService(dcMeta.getMetaServers());
LeaderElectorManager leaderElectorManager = createLeaderElectorManager(dcMeta);
logger.info("[startDc]{}\n\n", dc);
for (ClusterMeta clusterMeta : dcMeta.getClusters().values()) {
logger.info(remarkableMessage("[startCluster]{}"), clusterMeta.getId());
for (ShardMeta shardMeta : clusterMeta.getShards().values()) {
logger.info(remarkableMessage("[startShard]{}"), shardMeta.getId());
for (KeeperMeta keeperMeta : shardMeta.getKeepers()) {
startKeeper(keeperMeta, metaService, leaderElectorManager);
}
for (RedisMeta redisMeta : shardMeta.getRedises()) {
startRedis(redisMeta);
}
}
}
}
use of com.ctrip.xpipe.api.cluster.LeaderElectorManager in project x-pipe by ctripcorp.
the class DemoStarter method startKeepers.
private void startKeepers(String dc, String clusterId, String shardId, Integer index) throws Exception {
DcMeta dcMeta = getDcMeta(dc);
MetaServerKeeperService metaService = createMetaService(dcMeta.getMetaServers());
LeaderElectorManager leaderElectorManager = createLeaderElectorManager(dcMeta);
int count = 0;
for (KeeperMeta keeperMeta : getDcKeepers(dc, clusterId, shardId)) {
if (index == null || index == count) {
startKeeper(keeperMeta, metaService, leaderElectorManager);
}
count++;
}
}
use of com.ctrip.xpipe.api.cluster.LeaderElectorManager in project x-pipe by ctripcorp.
the class AbstractKeeperIntegratedMultiDc method startKeepers.
protected void startKeepers() throws Exception {
for (DcMeta dcMeta : getDcMetas()) {
MetaServerKeeperService metaService = createMetaService(dcMeta.getMetaServers());
LeaderElectorManager leaderElectorManager = createLeaderElectorManager(dcMeta);
for (KeeperMeta keeperMeta : getDcKeepers(dcMeta.getId(), getClusterId(), getShardId())) {
startKeeper(keeperMeta, metaService, leaderElectorManager);
}
}
}
Aggregations