Search in sources :

Example 1 with MetaServerKeeperService

use of com.ctrip.xpipe.redis.core.metaserver.MetaServerKeeperService 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);
            }
        }
    }
}
Also used : DcInfo(com.ctrip.xpipe.redis.integratedtest.DcInfo) MetaServerKeeperService(com.ctrip.xpipe.redis.core.metaserver.MetaServerKeeperService) LeaderElectorManager(com.ctrip.xpipe.api.cluster.LeaderElectorManager)

Example 2 with MetaServerKeeperService

use of com.ctrip.xpipe.redis.core.metaserver.MetaServerKeeperService 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++;
    }
}
Also used : MetaServerKeeperService(com.ctrip.xpipe.redis.core.metaserver.MetaServerKeeperService) LeaderElectorManager(com.ctrip.xpipe.api.cluster.LeaderElectorManager) DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta) KeeperMeta(com.ctrip.xpipe.redis.core.entity.KeeperMeta)

Example 3 with MetaServerKeeperService

use of com.ctrip.xpipe.redis.core.metaserver.MetaServerKeeperService 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);
        }
    }
}
Also used : MetaServerKeeperService(com.ctrip.xpipe.redis.core.metaserver.MetaServerKeeperService) LeaderElectorManager(com.ctrip.xpipe.api.cluster.LeaderElectorManager)

Aggregations

LeaderElectorManager (com.ctrip.xpipe.api.cluster.LeaderElectorManager)3 MetaServerKeeperService (com.ctrip.xpipe.redis.core.metaserver.MetaServerKeeperService)3 DcMeta (com.ctrip.xpipe.redis.core.entity.DcMeta)1 KeeperMeta (com.ctrip.xpipe.redis.core.entity.KeeperMeta)1 DcInfo (com.ctrip.xpipe.redis.integratedtest.DcInfo)1