use of com.ctrip.xpipe.redis.core.metaserver.MetaServerMultiDcService in project x-pipe by ctripcorp.
the class MultiDcNotifier method keeperActiveElected.
@Override
public void keeperActiveElected(String clusterId, String shardId, KeeperMeta activeKeeper) {
if (!dcMetaCache.isCurrentDcPrimary(clusterId, shardId)) {
logger.info("[keeperActiveElected][current dc backup, do nothing]{}, {}", clusterId, shardId, activeKeeper);
return;
}
if (activeKeeper == null) {
return;
}
Map<String, DcInfo> dcInfos = metaServerConfig.getDcInofs();
Set<String> backupDcs = dcMetaCache.getBakupDcs(clusterId, shardId);
logger.info("[keeperActiveElected][current dc primary, notify backup dc]{}, {}, {}, {}", clusterId, shardId, backupDcs, activeKeeper);
for (String backupDcName : backupDcs) {
DcInfo dcInfo = dcInfos.get(backupDcName);
if (dcInfo == null) {
logger.error("[keeperActiveElected][backup dc, but can not find dcinfo]{}, {}", backupDcName, dcInfos);
continue;
}
MetaServerMultiDcService metaServerMultiDcService = metaServerMultiDcServiceManager.getOrCreate(dcInfo.getMetaServerAddress());
executors.execute(new BackupDcNotifyTask(metaServerMultiDcService, clusterId, shardId, activeKeeper));
}
}
use of com.ctrip.xpipe.redis.core.metaserver.MetaServerMultiDcService in project x-pipe by ctripcorp.
the class DefaultMultiDcService method getActiveKeeper.
@Override
public KeeperMeta getActiveKeeper(String dcName, String clusterId, String shardId) {
dcName = dcName.toLowerCase();
DcInfo dcInfo = metaServerConfig.getDcInofs().get(dcName);
if (dcInfo == null) {
logger.error("[doChooseKeeperMaster][dc info null]{}", dcName);
return null;
}
MetaServerMultiDcService metaServerMultiDcService = metaServerMultiDcServiceManager.getOrCreate(dcInfo.getMetaServerAddress());
KeeperMeta keeperMeta = metaServerMultiDcService.getActiveKeeper(clusterId, shardId);
return keeperMeta;
}
Aggregations