diff --git a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/CommonConfigBean.java b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/CommonConfigBean.java index e077d3233..2f0e4efc7 100644 --- a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/CommonConfigBean.java +++ b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/CommonConfigBean.java @@ -9,6 +9,7 @@ import org.springframework.context.annotation.Configuration; import java.util.*; +import java.util.stream.Collectors; @Configuration public class CommonConfigBean extends AbstractConfigBean { @@ -68,7 +69,10 @@ public Set getExtraSyncDC() { } public boolean disableDb() { - return getExtraSyncDC().contains(FoundationService.DEFAULT.getDataCenter()); + return getExtraSyncDC().stream() + .map(String::toUpperCase) + .collect(Collectors.toSet()) + .contains(FoundationService.DEFAULT.getDataCenter()); } public Set getAlertWhileList() { diff --git a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/DataCenterConfigBean.java b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/DataCenterConfigBean.java index bb590988d..dc4177418 100644 --- a/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/DataCenterConfigBean.java +++ b/redis/redis-checker/src/main/java/com/ctrip/xpipe/redis/checker/config/impl/DataCenterConfigBean.java @@ -33,6 +33,8 @@ public class DataCenterConfigBean extends AbstractConfigBean { public static final String KEY_BEACON_ORG_ROUTE = "beacon.org.routes"; + public static final String KEY_CONSOLE_NO_DB_DOMAIN = "console.no.db.domain"; + private AtomicReference zkConnection = new AtomicReference<>(); private AtomicReference zkNameSpace = new AtomicReference<>(); @@ -40,6 +42,10 @@ public DataCenterConfigBean() { super(ConfigProvider.DEFAULT.getOrCreateConfig(ConfigProvider.DATA_CENTER_CONFIG_NAME)); } + public String getConsoleNoDbDomain() { + return getProperty(KEY_CONSOLE_NO_DB_DOMAIN, ""); + } + public String getZkConnectionString() { return getProperty(KEY_ZK_ADDRESS, zkConnection.get() == null ? "127.0.0.1:2181" : zkConnection.get()); } diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/ConsoleConfig.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/ConsoleConfig.java index c680f57cd..ca8f7e3bb 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/ConsoleConfig.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/ConsoleConfig.java @@ -154,4 +154,6 @@ public interface ConsoleConfig extends CoreConfig, CheckerConfig, AlertConfig { Set getExtraSyncDC(); + String getConsoleNoDbDomain(); + } diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/CombConsoleConfig.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/CombConsoleConfig.java deleted file mode 100644 index 4d66a2eda..000000000 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/CombConsoleConfig.java +++ /dev/null @@ -1,618 +0,0 @@ -package com.ctrip.xpipe.redis.console.config.impl; - -import com.ctrip.xpipe.api.codec.GenericTypeReference; -import com.ctrip.xpipe.api.config.ConfigChangeListener; -import com.ctrip.xpipe.api.foundation.FoundationService; -import com.ctrip.xpipe.cluster.ClusterType; -import com.ctrip.xpipe.codec.JsonCodec; -import com.ctrip.xpipe.config.AbstractConfigBean; -import com.ctrip.xpipe.config.ConfigKeyListener; -import com.ctrip.xpipe.redis.checker.config.impl.CheckConfigBean; -import com.ctrip.xpipe.redis.checker.config.impl.CommonConfigBean; -import com.ctrip.xpipe.redis.checker.config.impl.ConsoleConfigBean; -import com.ctrip.xpipe.redis.checker.config.impl.DataCenterConfigBean; -import com.ctrip.xpipe.redis.console.config.ConsoleConfig; -import com.ctrip.xpipe.redis.console.config.model.BeaconOrgRoute; -import com.ctrip.xpipe.redis.console.util.HickwallMetricInfo; -import com.ctrip.xpipe.redis.core.meta.QuorumConfig; -import com.ctrip.xpipe.tuple.Pair; -import com.ctrip.xpipe.utils.StringUtil; -import com.google.common.collect.Maps; -import io.netty.util.internal.ConcurrentSet; - -import java.util.*; - -public class CombConsoleConfig implements ConsoleConfig, ConfigChangeListener { - - private CheckConfigBean checkConfigBean; - - private ConsoleConfigBean consoleConfigBean; - - private DataCenterConfigBean dataCenterConfigBean; - - private CommonConfigBean commonConfigBean; - - private List configBeans; - - public CombConsoleConfig(CheckConfigBean checkConfigBean, - ConsoleConfigBean consoleConfigBean, - DataCenterConfigBean dataCenterConfigBean, - CommonConfigBean commonConfigBean) { - this.checkConfigBean = checkConfigBean; - this.consoleConfigBean = consoleConfigBean; - this.dataCenterConfigBean = dataCenterConfigBean; - this.commonConfigBean = commonConfigBean; - configBeans = new ArrayList<>(); - configBeans.add(consoleConfigBean); - configBeans.add(dataCenterConfigBean); - configBeans.add(commonConfigBean); - configBeans.add(checkConfigBean); - for (AbstractConfigBean configBean : configBeans) { - configBean.addConfigChangeListener(this); - } - } - - private Map> listeners = Maps.newConcurrentMap(); - - private Set listenersSet = new ConcurrentSet<>(); - - private String hickwallInfo; - - private HickwallMetricInfo info; - - - - @Override - public String getServerMode() { - return checkConfigBean.getServerMode(); - } - - @Override - public String getDatasource() { - return commonConfigBean.getDatasource(); - } - - @Override - public int getConsoleNotifyRetryTimes() { - return consoleConfigBean.getConsoleNotifyRetryTimes(); - } - - @Override - public int getConsoleNotifyRetryInterval() { - return consoleConfigBean.getConsoleNotifyRetryInterval(); - } - - @Override - public Map getMetaservers() { - return dataCenterConfigBean.getMetaservers(); - } - - @Override - public int getConsoleNotifyThreads() { - return consoleConfigBean.getConsoleNotifyThreads(); - } - - @Override - public Set getConsoleUserAccessWhiteList() { - return commonConfigBean.getConsoleUserAccessWhiteList(); - } - - @Override - public int getRedisReplicationHealthCheckInterval() { - return checkConfigBean.getRedisReplicationHealthCheckInterval(); - } - - @Override - public int getCheckerCurrentDcAllMetaRefreshIntervalMilli() { - return checkConfigBean.getCheckerCurrentDcAllMetaRefreshIntervalMilli(); - } - - @Override - public int getClusterHealthCheckInterval() { - return checkConfigBean.getClusterHealthCheckInterval(); - } - - @Override - public Map getHickwallClusterMetricFormat() { - return commonConfigBean.getHickwallClusterMetricFormat(); - } - - @Override - public HickwallMetricInfo getHickwallMetricInfo() { - String localInfo = commonConfigBean.getHickwallMetricInfo(); - if(StringUtil.isEmpty(hickwallInfo) || !localInfo.equals(hickwallInfo)) { - hickwallInfo = localInfo; - info = JsonCodec.INSTANCE.decode(hickwallInfo, HickwallMetricInfo.class); - } - return info; - } - - @Override - public int getHealthyDelayMilli() { - return checkConfigBean.getHealthyDelayMilli(); - } - - @Override - public long getHealthMarkCompensateIntervalMill() { - return checkConfigBean.getHealthMarkCompensateIntervalMill(); - } - - @Override - public int getHealthMarkCompensateThreads() { - return checkConfigBean.getHealthMarkCompensateThreads(); - } - - @Override - public int getHealthyDelayMilliThroughProxy() { - return checkConfigBean.getHealthyDelayMilliThroughProxy(); - } - - @Override - public int getInstanceLongDelayMilli() { - return checkConfigBean.getInstanceLongDelayMilli(); - } - - @Override - public int getDownAfterCheckNums() { - return checkConfigBean.getDownAfterCheckNums(); - } - - @Override - public int getDownAfterCheckNumsThroughProxy() { - return checkConfigBean.getDownAfterCheckNumsThroughProxy(); - } - - @Override - public int getCacheRefreshInterval() { - return consoleConfigBean.getCacheRefreshInterval(); - } - - @Override - public Set getAlertWhileList() { - return commonConfigBean.getAlertWhileList(); - } - - @Override - public int getQuorum() { - return checkConfigBean.getQuorum(); - } - - @Override - public int getRedisConfCheckIntervalMilli() { - return checkConfigBean.getRedisConfCheckIntervalMilli(); - } - - @Override - public int getSentinelCheckIntervalMilli() { - return checkConfigBean.getSentinelCheckIntervalMilli(); - } - - @Override - public String getConsoleDomain() { - return commonConfigBean.getConsoleDomain(); - } - - @Override - public String getClusterExcludedRegex() { - return commonConfigBean.getClusterExcludedRegex(); - } - - @Override - public QuorumConfig getDefaultSentinelQuorumConfig() { - return checkConfigBean.getDefaultSentinelQuorumConfig(); - } - - @Override - public int getStableLossAfterRounds() { - return checkConfigBean.getStableLossAfterRounds(); - } - - @Override - public int getStableRecoverAfterRounds() { - return checkConfigBean.getStableRecoverAfterRounds(); - } - - @Override - public int getStableResetAfterRounds() { - return checkConfigBean.getStableResetAfterRounds(); - } - - @Override - public float getSiteStableThreshold() { - return checkConfigBean.getSiteStableThreshold(); - } - - @Override - public float getSiteUnstableThreshold() { - return checkConfigBean.getSiteUnstableThreshold(); - } - - @Override - public Boolean getSiteStable() { - return checkConfigBean.getSiteStable(); - } - - @Override - public String getReplDisklessMinRedisVersion() { - return checkConfigBean.getReplDisklessMinRedisVersion(); - } - - @Override - public String getXRedisMinimumRequestVersion() { - return checkConfigBean.getXRedisMinimumRequestVersion(); - } - - @Override - public String getXpipeRuntimeEnvironment() { - return commonConfigBean.getXpipeRuntimeEnvironment(); - } - - @Override - public String getDBAEmails() { - return commonConfigBean.getDBAEmails(); - } - - @Override - public String getRedisAlertSenderEmail() { - return commonConfigBean.getRedisAlertSenderEmail(); - } - - @Override - public String getXPipeAdminEmails() { - return commonConfigBean.getXPipeAdminEmails(); - } - - @Override - public int getAlertSystemSuspendMinute() { - return commonConfigBean.getAlertSystemSuspendMinute(); - } - - @Override - public int getAlertSystemRecoverMinute() { - return commonConfigBean.getAlertSystemRecoverMinute(); - } - - @Override - public int getConfigDefaultRestoreHours() { - return consoleConfigBean.getConfigDefaultRestoreHours(); - } - - @Override - public int getRebalanceSentinelInterval() { - return consoleConfigBean.getRebalanceSentinelInterval(); - } - - @Override - public int getRebalanceSentinelMaxNumOnce() { - return consoleConfigBean.getRebalanceSentinelMaxNumOnce(); - } - - @Override - public int getNoAlarmMinutesForClusterUpdate() { - return commonConfigBean.getNoAlarmMinutesForClusterUpdate(); - } - - @Override - public int getHealthCheckSuspendMinutes() { - return consoleConfigBean.getHealthCheckSuspendMinutes(); - } - - @Override - public Set getIgnoredHealthCheckDc() { - return checkConfigBean.getIgnoredHealthCheckDc(); - } - - @Override - public int getClustersPartIndex() { - return checkConfigBean.getClustersPartIndex(); - } - - @Override - public int getCheckerReportIntervalMilli() { - return checkConfigBean.getCheckerReportIntervalMilli(); - } - - @Override - public int getCheckerMetaRefreshIntervalMilli() { - return checkConfigBean.getCheckerMetaRefreshIntervalMilli(); - } - - @Override - public String getConsoleAddress() { - return checkConfigBean.getConsoleAddress(); - } - - @Override - public int getCheckerAckIntervalMilli() { - return checkConfigBean.getCheckerAckIntervalMilli(); - } - - @Override - public long getConfigCacheTimeoutMilli() { - return checkConfigBean.getConfigCacheTimeoutMilli(); - } - - @Override - public int getProxyCheckUpRetryTimes() { - return checkConfigBean.getProxyCheckUpRetryTimes(); - } - - @Override - public int getProxyCheckDownRetryTimes() { - return checkConfigBean.getProxyCheckDownRetryTimes(); - } - - private Set sentinelCheckOuterClientClusters() { - return checkConfigBean.sentinelCheckOuterClientClusters(); - } - - @Override - public boolean supportSentinelHealthCheck(ClusterType clusterType, String clusterName) { - return clusterType.supportHealthCheck() - || checkConfigBean.shouldSentinelCheckOuterClientClusters() - || sentinelCheckOuterClientClusters().contains(clusterName.toLowerCase()); - } - - @Override - public void register(List keys, ConfigChangeListener configListener) { - for(String key : keys) { - listeners.putIfAbsent(key, new LinkedList<>()); - listeners.get(key).add(configListener); - } - } - - @Override - public String sentinelCheckDowngradeStrategy() { - return checkConfigBean.sentinelCheckDowngradeStrategy(); - } - - @Override - public String crossDcSentinelMonitorNameSuffix() { - return checkConfigBean.crossDcSentinelMonitorNameSuffix(); - } - - @Override - public int getNonCoreCheckIntervalMilli() { - return checkConfigBean.getNonCoreCheckIntervalMilli(); - } - - @Override - public Set getOuterClusterTypes() { - return consoleConfigBean.getOuterClusterTypes(); - } - - @Override - public Map sentinelMasterConfig() { - return checkConfigBean.sentinelMasterConfig(); - } - - @Override - public long subscribeTimeoutMilli() { - return checkConfigBean.subscribeTimeoutMilli(); - } - - @Override - public String getDcsRelations() { - return commonConfigBean.getDcsRelations(); - } - - @Override - public int maxRemovedDcsCnt() { - return checkConfigBean.maxRemovedDcsCnt(); - } - - @Override - public int maxRemovedClustersPercent() { - return checkConfigBean.maxRemovedClustersPercent(); - } - - @Override - public int getKeeperCheckerIntervalMilli() { - return checkConfigBean.getKeeperCheckerIntervalMilli(); - } - - @Override - public int getPingDownAfterMilli() { - return checkConfigBean.getPingDownAfterMilli(); - } - - @Override - public int getPingDownAfterMilliThroughProxy() { - return checkConfigBean.getPingDownAfterMilliThroughProxy(); - } - - @Override - public Pair getClusterShardForMigrationSysCheck() { - return consoleConfigBean.getClusterShardForMigrationSysCheck(); - } - - @Override - public int getProxyInfoCollectInterval() { - return consoleConfigBean.getProxyInfoCollectInterval(); - } - - @Override - public int getOutterClientCheckInterval() { - return checkConfigBean.getOutterClientCheckInterval(); - } - - @Override - public int getOuterClientSyncInterval() { - return consoleConfigBean.getOuterClientSyncInterval(); - } - - @Override - public String getOuterClientToken() { - return commonConfigBean.getOuterClientToken(); - } - - @Override - public Map getConsoleDomains() { - return dataCenterConfigBean.getConsoleDomains(); - } - - @Override - public boolean isSentinelRateLimitOpen() { - return checkConfigBean.isSentinelRateLimitOpen(); - } - - @Override - public int getSentinelRateLimitSize() { - return checkConfigBean.getSentinelRateLimitSize(); - } - - @Override - public Set getVariablesCheckDataSources() { - return consoleConfigBean.getVariablesCheckDataSources(); - } - - @Override - public Set getOwnClusterType() { - return consoleConfigBean.getOwnClusterType(); - } - - @Override - public Set shouldNotifyClusterTypes() { - return commonConfigBean.shouldNotifyClusterTypes(); - } - - @Override - public String getCrossDcLeaderLeaseName() { - return dataCenterConfigBean.getCrossDcLeaderLeaseName(); - } - - @Override - public List getBeaconOrgRoutes() { - String property = dataCenterConfigBean.getBeaconOrgRoutes(); - return JsonCodec.INSTANCE.decode(property, new GenericTypeReference>() {}); - } - - @Override - public int getClusterDividedParts() { - List groupList = checkConfigBean.getClustersList(); - return groupList.size(); - } - - @Override - public int getCheckerAckTimeoutMilli() { - return dataCenterConfigBean.getCheckerAckTimeoutMilli(); - } - - @Override - public long getMigrationTimeoutMilli() { - return consoleConfigBean.getMigrationTimeoutMilli(); - } - - @Override - public long getServletMethodTimeoutMilli() { - return consoleConfigBean.getServletMethodTimeoutMilli(); - } - - @Override - public boolean isRedisConfigCheckMonitorOpen() { - return checkConfigBean.isRedisConfigCheckMonitorOpen(); - } - - @Override - public String getRedisConfigCheckRules() { - return checkConfigBean.getRedisConfigCheckRules(); - } - - @Override - public String getChooseRouteStrategyType() { - return commonConfigBean.getChooseRouteStrategyType(); - } - - @Override - public boolean isAutoMigrateOverloadKeeperContainerOpen() { - return consoleConfigBean.isAutoMigrateOverloadKeeperContainerOpen(); - } - - @Override - public long getAutoMigrateOverloadKeeperContainerIntervalMilli() { - return consoleConfigBean.getAutoMigrateOverloadKeeperContainerIntervalMilli(); - } - - @Override - public double getKeeperPairOverLoadFactor() { - return consoleConfigBean.getKeeperPairOverLoadFactor(); - } - - @Override - public double getKeeperContainerDiskOverLoadFactor() { - return consoleConfigBean.getKeeperContainerDiskOverLoadFactor(); - } - - @Override - public double getKeeperContainerIoRate() { - return consoleConfigBean.getKeeperContainerIoRate(); - } - - @Override - public long getMetaServerSlotClusterMapCacheTimeOutMilli() { - return consoleConfigBean.getMetaServerSlotClusterMapCacheTimeOutMilli(); - } - - @Override - public boolean autoSetKeeperSyncLimit() { - return consoleConfigBean.autoSetKeeperSyncLimit(); - } - - @Override - public boolean disableDb() { - return commonConfigBean.disableDb(); - } - - @Override - public Set getExtraSyncDC() { - return commonConfigBean.getExtraSyncDC(); - } - - @Override - public void addListener(ConfigKeyListener listener) { - this.listenersSet.add(listener); - } - - @Override - public String getZkConnectionString() { - return dataCenterConfigBean.getZkConnectionString(); - } - - @Override - public String getZkNameSpace() { - return dataCenterConfigBean.getZkNameSpace(); - } - - public void onChange(String key, String oldValue, String newValue) { - - for(ConfigKeyListener listener : listenersSet) { - listener.onChange(key, newValue); - } - - if(!listeners.containsKey(key)) { - return; - } - for(ConfigChangeListener listener : listeners.get(key)) { - listener.onChange(key, oldValue, newValue); - } - } - - protected String getProperty(String key) { - for(AbstractConfigBean configBean : configBeans) { - String val = configBean.getProperty(key); - if(val != null) { - return val; - } - } - return null; - } - - protected String getProperty(String key, String def) { - String value = this.getProperty(key); - if(value == null) { - return def; - } else { - return value; - } - } -} diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java index a03fa76ba..7a7bb60d1 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfig.java @@ -4,205 +4,121 @@ import com.ctrip.xpipe.api.config.ConfigChangeListener; import com.ctrip.xpipe.cluster.ClusterType; import com.ctrip.xpipe.codec.JsonCodec; +import com.ctrip.xpipe.config.AbstractConfigBean; +import com.ctrip.xpipe.config.ConfigKeyListener; +import com.ctrip.xpipe.redis.checker.config.impl.CheckConfigBean; +import com.ctrip.xpipe.redis.checker.config.impl.CommonConfigBean; +import com.ctrip.xpipe.redis.checker.config.impl.ConsoleConfigBean; +import com.ctrip.xpipe.redis.checker.config.impl.DataCenterConfigBean; import com.ctrip.xpipe.redis.console.config.ConsoleConfig; import com.ctrip.xpipe.redis.console.config.model.BeaconOrgRoute; import com.ctrip.xpipe.redis.console.util.HickwallMetricInfo; -import com.ctrip.xpipe.redis.core.config.AbstractCoreConfig; import com.ctrip.xpipe.redis.core.meta.QuorumConfig; -import com.ctrip.xpipe.redis.core.route.RouteChooseStrategyFactory; import com.ctrip.xpipe.tuple.Pair; import com.ctrip.xpipe.utils.StringUtil; import com.google.common.collect.Maps; +import io.netty.util.internal.ConcurrentSet; import java.util.*; -import static com.ctrip.xpipe.redis.checker.config.impl.CheckConfigBean.*; +public class DefaultConsoleConfig implements ConsoleConfig, ConfigChangeListener { -/** - * @author shyin - *

- * Oct 19, 2016 - */ -public class DefaultConsoleConfig extends AbstractCoreConfig implements ConsoleConfig { + private CheckConfigBean checkConfigBean; - public static final String KEY_SERVER_MODE = "console.server.mode"; - public static final String KEY_DATASOURCE = "datasource"; - public static final String KEY_CONSOLE_NOTIFY_RETRY_TIMES = "console.notify.retry.times"; - public static final String KEY_CONSOLE_NOTIFY_THREADS = "console.notify.threads"; - public static final String KEY_CONSOLE_NOTIFY_RETRY_INTERVAL = "console.notify.retry.interval"; - public static final String KEY_METASERVERS = "metaservers"; - public static final String KEY_USER_ACCESS_WHITE_LIST = "user.access.white.list"; - public static final String KEY_HICKWALL_CLUSTER_METRIC_FORMAT = "console.hickwall.cluster.metric.format"; - public static final String KEY_HICKWALL_METRIC_INFO = "console.hickwall.metric.info"; - public static final String KEY_CACHE_REFERSH_INTERVAL = "console.cache.refresh.interval"; + private ConsoleConfigBean consoleConfigBean; - private static final String KEY_CONFIG_DEFAULT_RESTORE_HOUR = "console.config.default.restore.hour"; + private DataCenterConfigBean dataCenterConfigBean; - private static final String KEY_REBALANCE_SENTINEL_INTERVAL = "rebalance.sentinel.interval.second"; + private CommonConfigBean commonConfigBean; - private static final String KEY_REBALANCE_SENTINEL_MAX_NUM_ONCE = "rebalance.sentinel.max.num.once"; + private List configBeans; - public static final String KEY_CLUSTER_SHARD_FOR_MIGRATE_SYS_CHECK = "console.cluster.shard.for.migrate.sys.check"; - - private static final String KEY_PROXY_INFO_CHECK_INTERVAL = "console.proxy.info.collector.check.interval"; - - private static final String KEY_OUTTER_CLIENT_CHECK_INTERVAL = "console.outter.client.check.interval"; - - private static final String KEY_OUTER_CLIENT_SYNC_INTERVAL = "console.outer.client.sync.interval"; - - private static final String KEY_OUTER_CLIENT_TOKEN = "console.outer.client.token"; - - private static final String KEY_VARIABLES_CHECK_DATASOURCE = "console.health.variables.datasource"; - - private static final String KEY_OWN_CLUSTER_TYPES = "console.cluster.types"; - - private static final String KEY_NOTIFY_CLUSTER_TYPES = "console.notify.cluster.types"; - - private static final String KEY_OUTER_CLUSTER_TYPES = "console.outer.cluster.types"; - - private static final String KEY_NO_HEALTH_CHECK_MINUTES = "no.health.check.minutes"; - - private static final String KEY_CROSS_DC_LEADER_LEASE_NAME = "console.cross.dc.leader.lease.name"; - - public static final String KEY_BEACON_ORG_ROUTE = "beacon.org.routes"; - - private static final String KEY_CLUSTER_DIVIDED_PARTS = "console.cluster.divide.parts"; - - private static final String KEY_CHECKER_ACK_TIMEOUT_MILLI = "checker.ack.timeout.milli"; - - private static final String KEY_MIGRATION_TIMEOUT_MILLI = "migration.timeout.milli"; - - private static final String KEY_SERVLET_METHOD_TIMEOUT_MILLI = "servlet.method.timeout.milli"; - - private static final String KEY_REDIS_CONFIG_CHECK_MONITOR_OPEN = "cosnole.redis.config.check.open"; - - private static final String KEY_REDIS_CONFIG_CHECK_RULES = "console.redis.config.check.rules"; - private static final String KEY_CROSS_DC_SENTINEL_MONITOR_NAME_SUFFIX = "checker.cross.dc.sentinel.monitor.name.suffix"; - - private static final String KEY_SENTINEL_MASTER_CONFIG = "checker.sentinel.master.config"; - - private static final String KEY_ROUTE_CHOOSE_STRATEGY_TYPE = "route.choose.strategy.type"; - - private static final String KEY_DCS_RELATIONS = "dcs.relations"; - - private static final String KEY_MAX_REMOVED_DCS_CNT = "max.removed.dcs.count"; - private static final String KEY_MAX_REMOVED_CLUSTERS_PERCENT = "max.removed.clusters.percent"; - - private static final String KEY_CONSOLE_KEEPER_PAIR_OVERLOAD_FACTOR = "console.keeper.container.pair.overload.standard.factor"; - private static final String KEY_CONSOLE_KEEPER_CONTAINER_DISK_OVERLOAD_FACTOR = "console.keeper.container.disk.overload.factor"; - private static final String KEY_CONSOLE_KEEPER_CONTAINER_IO_RATE = "console.keeper.container.io.rate"; - private static final String KEY_CONSOLE_AUTO_MIGRATE_OVERLOAD_KEEPER_CONTAINER_OPEN = "console.auto.migrate.overload.keeper.container.open"; - private static final String KEY_CONSOLE_AUTO_MIGRATE_OVERLOAD_KEEPER_CONTAINER_INTERVAL_MILLI = "console.auto.migrate.overload.keeper.container.interval.milli"; - private static final String KEY_CONSOLE_META_SLOT_CACHE_MILLI = "console.meta.slot.cache.milli"; - - private static final String KEY_CLUSTERS_PART_INDEX = "checker.clusters.part.index" ; - - private static final String KEY_KEEPERCONTAINER_SYNC_LIMIT_ON = "keepercontainer.sync.limit.on"; - - private String defaultRouteChooseStrategyType = RouteChooseStrategyFactory.RouteStrategyType.CRC32_HASH.name(); - - private Map> listeners = Maps.newConcurrentMap(); - - @Override - public String getServerMode() { - return getProperty(KEY_SERVER_MODE, "CONSOLE_CHECKER"); - } - - @Override - public int getAlertSystemRecoverMinute() { - return getIntProperty(KEY_ALERT_MESSAGE_RECOVER_TIME, 5); + public DefaultConsoleConfig(CheckConfigBean checkConfigBean, + ConsoleConfigBean consoleConfigBean, + DataCenterConfigBean dataCenterConfigBean, + CommonConfigBean commonConfigBean) { + this.checkConfigBean = checkConfigBean; + this.consoleConfigBean = consoleConfigBean; + this.dataCenterConfigBean = dataCenterConfigBean; + this.commonConfigBean = commonConfigBean; + configBeans = new ArrayList<>(); + configBeans.add(consoleConfigBean); + configBeans.add(dataCenterConfigBean); + configBeans.add(commonConfigBean); + configBeans.add(checkConfigBean); + for (AbstractConfigBean configBean : configBeans) { + configBean.addConfigChangeListener(this); + } } - @Override - public int getAlertSystemSuspendMinute() { - return getIntProperty(KEY_ALERT_MESSAGE_SUSPEND_TIME, 30); - } + private Map> listeners = Maps.newConcurrentMap(); - @Override - public String getDBAEmails() { - return getProperty(KEY_DBA_EMAILS, "DBA@email.com"); - } + private Set listenersSet = new ConcurrentSet<>(); - @Override - public String getRedisAlertSenderEmail() { - return getProperty(KEY_REDIS_ALERT_SENDER_EMAIL, ""); - } + private String hickwallInfo; - @Override - public String getXpipeRuntimeEnvironment() { - return getProperty(KEY_XPIPE_RUNTIME_ENVIRONMENT, ""); - } + private HickwallMetricInfo info; - @Override - public String getXPipeAdminEmails() { - return getProperty(KEY_XPIPE_ADMIN_EMAILS, "XPipeAdmin@email.com"); - } - @Override - public String getReplDisklessMinRedisVersion() { - return getProperty(KEY_REDIS_REPL_DISKLESS_MINIMUM_VERSION, "2.8.22"); - } @Override - public String getXRedisMinimumRequestVersion() { - return getProperty(KEY_XREDIS_REQUEST_MINI_VERSION, "0.0.3"); + public String getServerMode() { + return checkConfigBean.getServerMode(); } @Override public String getDatasource() { - return getProperty(KEY_DATASOURCE, "fxxpipe"); + return commonConfigBean.getDatasource(); } @Override public int getConsoleNotifyRetryTimes() { - return getIntProperty(KEY_CONSOLE_NOTIFY_RETRY_TIMES, 3); + return consoleConfigBean.getConsoleNotifyRetryTimes(); } @Override public int getConsoleNotifyRetryInterval() { - return getIntProperty(KEY_CONSOLE_NOTIFY_RETRY_INTERVAL, 100); + return consoleConfigBean.getConsoleNotifyRetryInterval(); } @Override - public Map getMetaservers() { - String property = getProperty(KEY_METASERVERS, "{}"); - return JsonCodec.INSTANCE.decode(property, Map.class); + public Map getMetaservers() { + return dataCenterConfigBean.getMetaservers(); } @Override public int getConsoleNotifyThreads() { - return getIntProperty(KEY_CONSOLE_NOTIFY_THREADS, 20); + return consoleConfigBean.getConsoleNotifyThreads(); } @Override public Set getConsoleUserAccessWhiteList() { - String whiteList = getProperty(KEY_USER_ACCESS_WHITE_LIST, "*"); - return new HashSet<>(Arrays.asList(whiteList.split(","))); + return commonConfigBean.getConsoleUserAccessWhiteList(); } @Override public int getRedisReplicationHealthCheckInterval() { - return getIntProperty(KEY_REDIS_REPLICATION_HEALTH_CHECK_INTERVAL, 2000); + return checkConfigBean.getRedisReplicationHealthCheckInterval(); } @Override - public int getClusterHealthCheckInterval() { - return getIntProperty(KEY_CLUSTER_HEALTH_CHECK_INTERVAL, 300000); + public int getCheckerCurrentDcAllMetaRefreshIntervalMilli() { + return checkConfigBean.getCheckerCurrentDcAllMetaRefreshIntervalMilli(); } - private String hickwallInfo; - - private HickwallMetricInfo info; + @Override + public int getClusterHealthCheckInterval() { + return checkConfigBean.getClusterHealthCheckInterval(); + } @Override - public Map getHickwallClusterMetricFormat() { - String property = getProperty(KEY_HICKWALL_CLUSTER_METRIC_FORMAT, "{}"); - return JsonCodec.INSTANCE.decode(property, Map.class); + public Map getHickwallClusterMetricFormat() { + return commonConfigBean.getHickwallClusterMetricFormat(); } @Override public HickwallMetricInfo getHickwallMetricInfo() { - String localInfo = getProperty(KEY_HICKWALL_METRIC_INFO, "{\"domain\": \"http://hickwall.qa.nt.ctripcorp.com/grafanav2/d/UR32kfjWz/fx-xpipe?fullscreen&orgId=1&from=now-1h&to=now\", \"delayPanelId\": 2, \"crossDcDelayPanelId\": 14, \"proxyPingPanelId\": 4, \"proxyTrafficPanelId\": 6, \"proxyCollectionPanelId\": 8, \"outComingTrafficToPeerPanelId\": \"16\", \"inComingTrafficFromPeerPanelId\": \"18\",\"peerSyncFullPanelId\": \"20\",\"peerSyncPartialPanelId\": \"22\"}"); + String localInfo = commonConfigBean.getHickwallMetricInfo(); if(StringUtil.isEmpty(hickwallInfo) || !localInfo.equals(hickwallInfo)) { hickwallInfo = localInfo; info = JsonCodec.INSTANCE.decode(hickwallInfo, HickwallMetricInfo.class); @@ -212,438 +128,495 @@ public HickwallMetricInfo getHickwallMetricInfo() { @Override public int getHealthyDelayMilli() { - return getIntProperty(KEY_HEALTHY_DELAY, 2000); + return checkConfigBean.getHealthyDelayMilli(); } @Override public long getHealthMarkCompensateIntervalMill() { - return getLongProperty(KEY_HEALTHY_MARK_COMPENSATE_INTERVAL_MILLI, 2 * 60 * 1000L); + return checkConfigBean.getHealthMarkCompensateIntervalMill(); } @Override public int getHealthMarkCompensateThreads() { - return getIntProperty(KEY_HEALTHY_MARK_COMPENSATE_THREADS, 20); + return checkConfigBean.getHealthMarkCompensateThreads(); } @Override public int getHealthyDelayMilliThroughProxy() { - return getIntProperty(KEY_HEALTHY_DELAY_THROUGH_PROXY, 30 * 1000); + return checkConfigBean.getHealthyDelayMilliThroughProxy(); } @Override public int getInstanceLongDelayMilli() { - return getIntProperty(KEY_INSTANCE_LONG_DELAY_MILLI, 3 * 60 * 1000); + return checkConfigBean.getInstanceLongDelayMilli(); } @Override public int getDownAfterCheckNums() { - return getIntProperty(KEY_DOWN_AFTER_CHECK_NUMS, 5); + return checkConfigBean.getDownAfterCheckNums(); } @Override public int getDownAfterCheckNumsThroughProxy() { - return getIntProperty(KEY_DOWN_AFTER_CHECK_NUMS_THROUGH_PROXY, 10); + return checkConfigBean.getDownAfterCheckNumsThroughProxy(); } @Override public int getCacheRefreshInterval() { - return getIntProperty(KEY_CACHE_REFERSH_INTERVAL, 1000); + return consoleConfigBean.getCacheRefreshInterval(); } @Override public Set getAlertWhileList() { - String whitelist = getProperty(KEY_ALERT_WHITE_LIST, ""); - - return getSplitStringSet(whitelist); - + return commonConfigBean.getAlertWhileList(); } @Override public int getQuorum() { - return getIntProperty(KEY_QUORUM, 1); + return checkConfigBean.getQuorum(); } @Override public int getRedisConfCheckIntervalMilli() { - - return getIntProperty( - KEY_REDIS_CONF_CHECK_INTERVAL, - Integer.parseInt(System.getProperty(KEY_REDIS_CONF_CHECK_INTERVAL, "300000")) - ); + return checkConfigBean.getRedisConfCheckIntervalMilli(); } @Override public int getSentinelCheckIntervalMilli() { - return getIntProperty(KEY_SENTINEL_CHECK_INTERVAL, 300000); + return checkConfigBean.getSentinelCheckIntervalMilli(); } @Override public String getConsoleDomain() { - return getProperty(KEY_DOMAIN, "127.0.0.1"); + return commonConfigBean.getConsoleDomain(); + } + + @Override + public String getClusterExcludedRegex() { + return commonConfigBean.getClusterExcludedRegex(); } @Override public QuorumConfig getDefaultSentinelQuorumConfig() { + return checkConfigBean.getDefaultSentinelQuorumConfig(); + } - String config = getProperty(KEY_SENTINEL_QUORUM, "{}"); - return JsonCodec.INSTANCE.decode(config, QuorumConfig.class); + @Override + public int getStableLossAfterRounds() { + return checkConfigBean.getStableLossAfterRounds(); } @Override - public int getConfigDefaultRestoreHours() { - return getIntProperty(KEY_CONFIG_DEFAULT_RESTORE_HOUR, 10); + public int getStableRecoverAfterRounds() { + return checkConfigBean.getStableRecoverAfterRounds(); } @Override - public int getRebalanceSentinelInterval() { - return getIntProperty(KEY_REBALANCE_SENTINEL_INTERVAL, 120); + public int getStableResetAfterRounds() { + return checkConfigBean.getStableResetAfterRounds(); } @Override - public int getRebalanceSentinelMaxNumOnce() { - return getIntProperty(KEY_REBALANCE_SENTINEL_MAX_NUM_ONCE, 15); + public float getSiteStableThreshold() { + return checkConfigBean.getSiteStableThreshold(); } @Override - public int getNoAlarmMinutesForClusterUpdate() { - return getIntProperty(KEY_NO_ALARM_MUNITE_FOR_CLUSTER_UPDATE, 15); + public float getSiteUnstableThreshold() { + return checkConfigBean.getSiteUnstableThreshold(); } @Override - public int getHealthCheckSuspendMinutes() { - return getIntProperty(KEY_NO_HEALTH_CHECK_MINUTES, 40); + public Boolean getSiteStable() { + return checkConfigBean.getSiteStable(); } @Override - public Set getIgnoredHealthCheckDc() { - return getSplitStringSet(getProperty(KEY_IGNORED_DC_FOR_HEALTH_CHECK, "")); + public String getReplDisklessMinRedisVersion() { + return checkConfigBean.getReplDisklessMinRedisVersion(); } @Override - public int getPingDownAfterMilli() { - return getIntProperty(KEY_PING_DOWN_AFTER_MILLI, 12 * 1000); + public String getXRedisMinimumRequestVersion() { + return checkConfigBean.getXRedisMinimumRequestVersion(); } @Override - public int getPingDownAfterMilliThroughProxy() { - return getIntProperty(KEY_PING_DOWN_AFTER_MILLI_THROUGH_PROXY, 30 * 1000); + public String getXpipeRuntimeEnvironment() { + return commonConfigBean.getXpipeRuntimeEnvironment(); } @Override - public void onChange(String key, String oldValue, String newValue) { - super.onChange(key, oldValue, newValue); - if(!listeners.containsKey(key)) { - return; - } - for(ConfigChangeListener listener : listeners.get(key)) { - listener.onChange(key, oldValue, newValue); - } + public String getDBAEmails() { + return commonConfigBean.getDBAEmails(); } @Override - public void register(List keys, ConfigChangeListener configListener) { - for(String key : keys) { - listeners.putIfAbsent(key, new LinkedList<>()); - listeners.get(key).add(configListener); - } + public String getRedisAlertSenderEmail() { + return commonConfigBean.getRedisAlertSenderEmail(); } @Override - public Pair getClusterShardForMigrationSysCheck() { - String clusterShard = getProperty(KEY_CLUSTER_SHARD_FOR_MIGRATE_SYS_CHECK, "cluster1, shard1"); - String[] strs = StringUtil.splitRemoveEmpty("\\s*,\\s*", clusterShard); - return Pair.from(strs[0], strs[1]); + public String getXPipeAdminEmails() { + return commonConfigBean.getXPipeAdminEmails(); } @Override - public int getProxyInfoCollectInterval() { - return getIntProperty(KEY_PROXY_INFO_CHECK_INTERVAL, 30 * 1000); + public int getAlertSystemSuspendMinute() { + return commonConfigBean.getAlertSystemSuspendMinute(); } @Override - public int getOutterClientCheckInterval() { - return getIntProperty(KEY_OUTTER_CLIENT_CHECK_INTERVAL, 120 * 1000); + public int getAlertSystemRecoverMinute() { + return commonConfigBean.getAlertSystemRecoverMinute(); } @Override - public int getOuterClientSyncInterval() { - return getIntProperty(KEY_OUTER_CLIENT_SYNC_INTERVAL, 10 * 1000); + public int getConfigDefaultRestoreHours() { + return consoleConfigBean.getConfigDefaultRestoreHours(); } @Override - public String getOuterClientToken() { - return getProperty(KEY_OUTER_CLIENT_TOKEN, ""); + public int getRebalanceSentinelInterval() { + return consoleConfigBean.getRebalanceSentinelInterval(); } @Override - public Map getConsoleDomains() { - String property = getProperty(KEY_CONSOLE_DOMAINS, "{}"); - return JsonCodec.INSTANCE.decode(property, Map.class); + public int getRebalanceSentinelMaxNumOnce() { + return consoleConfigBean.getRebalanceSentinelMaxNumOnce(); } @Override - public boolean isSentinelRateLimitOpen() { - return getBooleanProperty(KEY_SENTINEL_RATE_LIMIT_OPEN, false); + public int getNoAlarmMinutesForClusterUpdate() { + return commonConfigBean.getNoAlarmMinutesForClusterUpdate(); } @Override - public int getSentinelRateLimitSize() { - return getIntProperty(KEY_SENTINEL_RATE_LIMIT_SIZE, 3); + public int getHealthCheckSuspendMinutes() { + return consoleConfigBean.getHealthCheckSuspendMinutes(); } @Override - public Set getVariablesCheckDataSources() { - String dataSources = getProperty(KEY_VARIABLES_CHECK_DATASOURCE, ""); + public Set getIgnoredHealthCheckDc() { + return checkConfigBean.getIgnoredHealthCheckDc(); + } - return getSplitStringSet(dataSources); + @Override + public int getClustersPartIndex() { + return checkConfigBean.getClustersPartIndex(); } @Override - public Set getOwnClusterType() { - String clusterTypes = getProperty(KEY_OWN_CLUSTER_TYPES, ClusterType.ONE_WAY.toString()); + public int getCheckerReportIntervalMilli() { + return checkConfigBean.getCheckerReportIntervalMilli(); + } - return getSplitStringSet(clusterTypes); + @Override + public int getCheckerMetaRefreshIntervalMilli() { + return checkConfigBean.getCheckerMetaRefreshIntervalMilli(); } @Override - public Set shouldNotifyClusterTypes() { - String clusterTypes = getProperty(KEY_NOTIFY_CLUSTER_TYPES, ClusterType.ONE_WAY.toString()+","+ClusterType.BI_DIRECTION.toString()); + public String getConsoleAddress() { + return checkConfigBean.getConsoleAddress(); + } - return getSplitStringSet(clusterTypes); + @Override + public int getCheckerAckIntervalMilli() { + return checkConfigBean.getCheckerAckIntervalMilli(); } @Override - public Set getOuterClusterTypes() { - String clusterTypes = getProperty(KEY_OUTER_CLUSTER_TYPES, ""); + public long getConfigCacheTimeoutMilli() { + return checkConfigBean.getConfigCacheTimeoutMilli(); + } - return getSplitStringSet(clusterTypes); + @Override + public int getProxyCheckUpRetryTimes() { + return checkConfigBean.getProxyCheckUpRetryTimes(); } - boolean shouldSentinelCheckOuterClientClusters() { - return getBooleanProperty(KEY_SHOULD_SENTINEL_CHECK_OUTER_TYPES, false); + @Override + public int getProxyCheckDownRetryTimes() { + return checkConfigBean.getProxyCheckDownRetryTimes(); } - Set sentinelCheckOuterClientClusters() { - return getSplitStringSet(getProperty(KEY_SENTINEL_CHECK_OUTER_CLUSTERS, "").toLowerCase()); + private Set sentinelCheckOuterClientClusters() { + return checkConfigBean.sentinelCheckOuterClientClusters(); } - // check if outer client clusters support sentinel health check or not @Override public boolean supportSentinelHealthCheck(ClusterType clusterType, String clusterName) { - return clusterType.supportHealthCheck() || shouldSentinelCheckOuterClientClusters() || sentinelCheckOuterClientClusters().contains(clusterName.toLowerCase()); + return clusterType.supportHealthCheck() + || checkConfigBean.shouldSentinelCheckOuterClientClusters() + || sentinelCheckOuterClientClusters().contains(clusterName.toLowerCase()); } @Override - public String sentinelCheckDowngradeStrategy() { - return getProperty(KEY_SENTINEL_CHECK_DOWNGRADE_STRATEGY, "lessThanHalf"); + public void register(List keys, ConfigChangeListener configListener) { + for(String key : keys) { + listeners.putIfAbsent(key, new LinkedList<>()); + listeners.get(key).add(configListener); + } } @Override - public String getCrossDcLeaderLeaseName() { - return getProperty(KEY_CROSS_DC_LEADER_LEASE_NAME, "CROSS_DC_LEADER"); + public String sentinelCheckDowngradeStrategy() { + return checkConfigBean.sentinelCheckDowngradeStrategy(); } @Override - public int getStableLossAfterRounds() { - return getIntProperty(KEY_CHECKER_STABLE_LOSS_AFTER_ROUNDS, 10); + public String crossDcSentinelMonitorNameSuffix() { + return checkConfigBean.crossDcSentinelMonitorNameSuffix(); } @Override - public int getStableRecoverAfterRounds() { - return getIntProperty(KEY_CHECKER_STABLE_RECOVER_AFTER_ROUNDS, 30 * 30); + public int getNonCoreCheckIntervalMilli() { + return checkConfigBean.getNonCoreCheckIntervalMilli(); } @Override - public int getStableResetAfterRounds() { - return getIntProperty(KEY_CHECKER_STABLE_RESET_AFTER_ROUNDS, 30); + public Set getOuterClusterTypes() { + return consoleConfigBean.getOuterClusterTypes(); } @Override - public float getSiteStableThreshold() { - return getFloatProperty(KEY_CHECKER_STABLE_THRESHOLD, 0.8f); + public Map sentinelMasterConfig() { + return checkConfigBean.sentinelMasterConfig(); } @Override - public Boolean getSiteStable() { - return getBooleanProperty(KEY_CHECKER_SITE_STABLE, null); + public long subscribeTimeoutMilli() { + return checkConfigBean.subscribeTimeoutMilli(); } @Override - public float getSiteUnstableThreshold() { - return getFloatProperty(KEY_CHECKER_UNSTABLE_THRESHOLD, 0.8f); + public String getDcsRelations() { + return commonConfigBean.getDcsRelations(); } @Override - public List getBeaconOrgRoutes() { - String property = getProperty(KEY_BEACON_ORG_ROUTE, "[]"); - return JsonCodec.INSTANCE.decode(property, new GenericTypeReference>() {}); + public int maxRemovedDcsCnt() { + return checkConfigBean.maxRemovedDcsCnt(); } @Override - public int getClusterDividedParts() { - return getIntProperty(KEY_CLUSTER_DIVIDED_PARTS, 1); + public int maxRemovedClustersPercent() { + return checkConfigBean.maxRemovedClustersPercent(); } @Override - public int getClustersPartIndex() { - return getIntProperty(KEY_CLUSTERS_PART_INDEX, 0); + public int getKeeperCheckerIntervalMilli() { + return checkConfigBean.getKeeperCheckerIntervalMilli(); } @Override - public int getCheckerAckIntervalMilli() { - return getIntProperty(KEY_CHECKER_ACK_INTERVAL, 10000); + public int getPingDownAfterMilli() { + return checkConfigBean.getPingDownAfterMilli(); } @Override - public int getCheckerAckTimeoutMilli() { - return getIntProperty(KEY_CHECKER_ACK_TIMEOUT_MILLI, 60000); + public int getPingDownAfterMilliThroughProxy() { + return checkConfigBean.getPingDownAfterMilliThroughProxy(); } @Override - public int getCheckerReportIntervalMilli() { - return getIntProperty(KEY_CHECKER_REPORT_INTERVAL, 10000); + public Pair getClusterShardForMigrationSysCheck() { + return consoleConfigBean.getClusterShardForMigrationSysCheck(); } @Override - public int getCheckerCurrentDcAllMetaRefreshIntervalMilli() { - return getIntProperty(KEY_CHECKER_CURRENT_DC_ALL_META_REFRESH_INTERVAL, 60 * 1000); + public int getProxyInfoCollectInterval() { + return consoleConfigBean.getProxyInfoCollectInterval(); } @Override - public int getCheckerMetaRefreshIntervalMilli() { - return getIntProperty(KEY_CHECKER_META_REFRESH_INTERVAL, 30000); + public int getOutterClientCheckInterval() { + return checkConfigBean.getOutterClientCheckInterval(); } @Override - public String getConsoleAddress() { - return getProperty(KEY_CONSOLE_ADDRESS, "http://localhost:8080"); + public int getOuterClientSyncInterval() { + return consoleConfigBean.getOuterClientSyncInterval(); } @Override - public long getConfigCacheTimeoutMilli() { - return getLongProperty(KEY_CONFIG_CACHE_TIMEOUT_MILLI, 1000L); + public String getOuterClientToken() { + return commonConfigBean.getOuterClientToken(); } @Override - public int getProxyCheckUpRetryTimes() { - return getIntProperty(KEY_PROXY_CHECK_UP_RETRY_TIMES, 10); + public Map getConsoleDomains() { + return dataCenterConfigBean.getConsoleDomains(); } @Override - public int getProxyCheckDownRetryTimes() { - return getIntProperty(KEY_PROXY_CHECK_DOWN_RETRY_TIMES, 1); - } - - @Override - public long getMigrationTimeoutMilli() { - return getLongProperty(KEY_MIGRATION_TIMEOUT_MILLI, 15000L); + public boolean isSentinelRateLimitOpen() { + return checkConfigBean.isSentinelRateLimitOpen(); } @Override - public long getServletMethodTimeoutMilli() { - return getLongProperty(KEY_SERVLET_METHOD_TIMEOUT_MILLI, 10000L); + public int getSentinelRateLimitSize() { + return checkConfigBean.getSentinelRateLimitSize(); } - public boolean isRedisConfigCheckMonitorOpen() { - return getBooleanProperty(KEY_REDIS_CONFIG_CHECK_MONITOR_OPEN, false); + @Override + public Set getVariablesCheckDataSources() { + return consoleConfigBean.getVariablesCheckDataSources(); } @Override - public String getRedisConfigCheckRules() { - return getProperty(KEY_REDIS_CONFIG_CHECK_RULES); + public Set getOwnClusterType() { + return consoleConfigBean.getOwnClusterType(); } - public String crossDcSentinelMonitorNameSuffix() { - return getProperty(KEY_CROSS_DC_SENTINEL_MONITOR_NAME_SUFFIX, "CROSS_DC"); + @Override + public Set shouldNotifyClusterTypes() { + return commonConfigBean.shouldNotifyClusterTypes(); } @Override - public int getNonCoreCheckIntervalMilli() { - return getIntProperty(KEY_NON_CORE_CHECK_INTERVAL, 3 * 60 * 60 * 1000); + public String getCrossDcLeaderLeaseName() { + return dataCenterConfigBean.getCrossDcLeaderLeaseName(); } @Override - public Map sentinelMasterConfig() { - String property = getProperty(KEY_SENTINEL_MASTER_CONFIG, "{}"); - return JsonCodec.INSTANCE.decode(property, Map.class); + public List getBeaconOrgRoutes() { + String property = dataCenterConfigBean.getBeaconOrgRoutes(); + return JsonCodec.INSTANCE.decode(property, new GenericTypeReference>() {}); } @Override - public long subscribeTimeoutMilli() { - return getLongProperty(KEY_SUBSCRIBE_TIMEOUT_MILLI, 5000L); + public int getClusterDividedParts() { + List groupList = checkConfigBean.getClustersList(); + return groupList.size(); } @Override - public String getDcsRelations() { - return getProperty(KEY_DCS_RELATIONS, "{}"); + public int getCheckerAckTimeoutMilli() { + return dataCenterConfigBean.getCheckerAckTimeoutMilli(); } @Override - public String getChooseRouteStrategyType() { return getProperty(KEY_ROUTE_CHOOSE_STRATEGY_TYPE, defaultRouteChooseStrategyType);} + public long getMigrationTimeoutMilli() { + return consoleConfigBean.getMigrationTimeoutMilli(); + } @Override - public String getClusterExcludedRegex() { - return getProperty(KEY_ALERT_CLUSTER_EXCLUDED_REGEX, ""); + public long getServletMethodTimeoutMilli() { + return consoleConfigBean.getServletMethodTimeoutMilli(); } @Override - public int maxRemovedDcsCnt() { - return getIntProperty(KEY_MAX_REMOVED_DCS_CNT, 1); + public boolean isRedisConfigCheckMonitorOpen() { + return checkConfigBean.isRedisConfigCheckMonitorOpen(); } @Override - public int maxRemovedClustersPercent() { - return getIntProperty(KEY_MAX_REMOVED_CLUSTERS_PERCENT, 50); + public String getRedisConfigCheckRules() { + return checkConfigBean.getRedisConfigCheckRules(); } @Override - public int getKeeperCheckerIntervalMilli() { - return getIntProperty(KEY_KEEPER_CHECKER_INTERVAL, 60 * 1000); + public String getChooseRouteStrategyType() { + return commonConfigBean.getChooseRouteStrategyType(); } @Override public boolean isAutoMigrateOverloadKeeperContainerOpen() { - return getBooleanProperty(KEY_CONSOLE_AUTO_MIGRATE_OVERLOAD_KEEPER_CONTAINER_OPEN, false); + return consoleConfigBean.isAutoMigrateOverloadKeeperContainerOpen(); } @Override public long getAutoMigrateOverloadKeeperContainerIntervalMilli() { - return getLongProperty(KEY_CONSOLE_AUTO_MIGRATE_OVERLOAD_KEEPER_CONTAINER_INTERVAL_MILLI, 60 * 60 * 1000L); + return consoleConfigBean.getAutoMigrateOverloadKeeperContainerIntervalMilli(); } @Override public double getKeeperPairOverLoadFactor() { - return getFloatProperty(KEY_CONSOLE_KEEPER_PAIR_OVERLOAD_FACTOR, 0.25F); + return consoleConfigBean.getKeeperPairOverLoadFactor(); } @Override public double getKeeperContainerDiskOverLoadFactor() { - return getFloatProperty(KEY_CONSOLE_KEEPER_CONTAINER_DISK_OVERLOAD_FACTOR, 0.8F); + return consoleConfigBean.getKeeperContainerDiskOverLoadFactor(); } @Override public double getKeeperContainerIoRate() { - return getFloatProperty(KEY_CONSOLE_KEEPER_CONTAINER_IO_RATE, 500F); + return consoleConfigBean.getKeeperContainerIoRate(); } @Override public long getMetaServerSlotClusterMapCacheTimeOutMilli() { - return getLongProperty(KEY_CONSOLE_META_SLOT_CACHE_MILLI, 30 * 1000L); + return consoleConfigBean.getMetaServerSlotClusterMapCacheTimeOutMilli(); } @Override public boolean autoSetKeeperSyncLimit() { - return getBooleanProperty(KEY_KEEPERCONTAINER_SYNC_LIMIT_ON, false); + return consoleConfigBean.autoSetKeeperSyncLimit(); } @Override public boolean disableDb() { - return false; + return commonConfigBean.disableDb(); } @Override public Set getExtraSyncDC() { - return Collections.emptySet(); + return commonConfigBean.getExtraSyncDC(); + } + + @Override + public String getConsoleNoDbDomain() { + return dataCenterConfigBean.getConsoleNoDbDomain(); + } + + @Override + public void addListener(ConfigKeyListener listener) { + this.listenersSet.add(listener); } + @Override + public String getZkConnectionString() { + return dataCenterConfigBean.getZkConnectionString(); + } + + @Override + public String getZkNameSpace() { + return dataCenterConfigBean.getZkNameSpace(); + } + + public void onChange(String key, String oldValue, String newValue) { + + for(ConfigKeyListener listener : listenersSet) { + listener.onChange(key, newValue); + } + + if(!listeners.containsKey(key)) { + return; + } + for(ConfigChangeListener listener : listeners.get(key)) { + listener.onChange(key, oldValue, newValue); + } + } + + protected String getProperty(String key) { + for(AbstractConfigBean configBean : configBeans) { + String val = configBean.getProperty(key); + if(val != null) { + return val; + } + } + return null; + } + + protected String getProperty(String key, String def) { + String value = this.getProperty(key); + if(value == null) { + return def; + } else { + return value; + } + } } diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/checker/ConsoleCheckerController.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/checker/ConsoleCheckerController.java index d40ba7808..0d377b488 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/checker/ConsoleCheckerController.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/checker/ConsoleCheckerController.java @@ -19,6 +19,7 @@ import com.ctrip.xpipe.redis.checker.spring.ConsoleServerMode; import com.ctrip.xpipe.redis.checker.spring.ConsoleServerModeCondition; import com.ctrip.xpipe.redis.console.checker.CheckerManager; +import com.ctrip.xpipe.redis.console.config.ConsoleConfig; import com.ctrip.xpipe.redis.console.controller.AbstractConsoleController; import com.ctrip.xpipe.redis.console.healthcheck.nonredis.cluster.ClusterHealthMonitorManager; import com.ctrip.xpipe.redis.console.keeper.KeeperContainerUsedInfoAnalyzer; @@ -29,15 +30,18 @@ import com.ctrip.xpipe.redis.core.entity.DcMeta; import com.ctrip.xpipe.redis.core.entity.XpipeMeta; import com.ctrip.xpipe.redis.core.meta.MetaCache; +import com.ctrip.xpipe.spring.AbstractSpringConfigContext; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.async.DeferredResult; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.*; +import java.util.concurrent.ExecutorService; /** * @author lishanglin @@ -47,6 +51,9 @@ @ConsoleServerMode(ConsoleServerModeCondition.SERVER_MODE.CONSOLE) public class ConsoleCheckerController extends AbstractConsoleController { + @Resource(name = AbstractSpringConfigContext.GLOBAL_EXECUTOR) + private ExecutorService executors; + @Autowired private MetaCache metaCache; @@ -81,6 +88,8 @@ public class ConsoleCheckerController extends AbstractConsoleController { private CheckerDbConfig checkerDbConfig; private Logger logger = LoggerFactory.getLogger(ConsoleCheckerController.class); + @Autowired + private ConsoleConfig consoleConfig; @GetMapping(ConsoleCheckerPath.PATH_GET_META) public String getDividedMeta(@PathVariable int index, @RequestParam(value="format", required = false) String format) { @@ -96,10 +105,23 @@ public String getDividedMeta(@RequestParam(value="format", required = false) Str } @GetMapping(ConsoleCheckerPath.PATH_GET_ALL_META_LONG_PULL) - public String getDividedMetaLongPull(@RequestParam(value="format", required = false) String format, - @RequestParam(value="updateTime") long updateTime) throws InterruptedException { - XpipeMeta xpipeMeta = metaCache.getXpipeMetaLongPull(updateTime); - return (format != null && format.equals("xml"))? xpipeMeta.toString() : coder.encode(xpipeMeta); + public DeferredResult getDividedMetaLongPull(@RequestParam(value="format", required = false) String format, + @RequestParam(value="updateTime") long updateTime) { + DeferredResult response = new DeferredResult<>(Long.valueOf(consoleConfig.getServletMethodTimeoutMilli())); + + executors.execute(new Runnable() { + @Override + public void run() { + try { + XpipeMeta xpipeMeta = metaCache.getXpipeMetaLongPull(updateTime); + response.setResult((format != null && format.equals("xml"))? xpipeMeta.toString() : coder.encode(xpipeMeta)); + } catch (InterruptedException e) { + response.setErrorResult(e.getMessage()); + } + } + }); + + return response; } @GetMapping(ConsoleCheckerPath.PATH_GET_DC_ALL_META) diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/ds/MybatisDataSourceConfig.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/ds/MybatisDataSourceConfig.java index c763319e8..4f30ef053 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/ds/MybatisDataSourceConfig.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/ds/MybatisDataSourceConfig.java @@ -13,6 +13,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.unidal.dal.jdbc.DalException; import org.unidal.dal.jdbc.datasource.DataSource; import org.unidal.dal.jdbc.datasource.DataSourceManager; import org.unidal.lookup.ContainerLoader; @@ -34,9 +35,13 @@ public MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean() throws Except @Bean public javax.sql.DataSource dataSource() throws Exception { - // 强制查询使Xpipe DataSource初始化 - ConfigTblDao configTblDao = ContainerLoader.getDefaultContainer().lookup(ConfigTblDao.class); - configTblDao.findByPK(1L, ConfigTblEntity.READSET_FULL); + try { + // 强制查询使Xpipe DataSource初始化 + ConfigTblDao configTblDao = ContainerLoader.getDefaultContainer().lookup(ConfigTblDao.class); + configTblDao.findByPK(1L, ConfigTblEntity.READSET_FULL); + } catch (ComponentLookupException | DalException e) { + logger.error("[MybatisDataSourceConfig]", e); + } XPipeDataSource dataSource = tryGetXpipeDataSource(); if (dataSource == null) { logger.info("[mybatisSqlSessionFactoryBean] no xpipe datasource found"); diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/AbstractMetaCache.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/AbstractMetaCache.java index ac76eb390..d5397b68d 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/AbstractMetaCache.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/AbstractMetaCache.java @@ -89,7 +89,6 @@ protected void refreshMeta(XpipeMeta xpipeMeta) { monitor2ClusterShard = Maps.newHashMap(); allKeeperSize = allKeepers == null ? DEFAULT_KEEPER_NUMBERS : allKeepers.size(); allKeepers = null; - lastUpdateTime = System.currentTimeMillis(); } protected XpipeMeta createXpipeMeta(List dcMetas, List redisCheckRuleMetas){ @@ -105,6 +104,8 @@ protected XpipeMeta createXpipeMeta(List dcMetas, List getAllAzGroups() { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/azGroup/all").build(); ResponseEntity> resp = exchange(comp.toUri(), HttpMethod.GET, null, new ParameterizedTypeReference>(){}, "getAllAzGroups"); @@ -52,7 +53,7 @@ public List getAllAzGroups() { public List getAllProxy() { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + "/api/proxies/all").build(); + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + "/api/proxies/all").build(); ResponseEntity> resp = exchange(comp.toUri(), HttpMethod.GET, null, new ParameterizedTypeReference>(){}, "getAllProxy"); @@ -61,7 +62,7 @@ public List getAllProxy() { public List getMonitorActiveProxiesByDc() { String dc = foundationService.getDataCenter(); - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + "/api/proxies/monitor_active") + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + "/api/proxies/monitor_active") .queryParam("dc", dc) .build(); @@ -72,7 +73,7 @@ public List getMonitorActiveProxiesByDc() { } public XpipeMeta getXpipeAllMeta(long updateTime) throws SAXException, IOException { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + ConsoleCheckerPath.PATH_GET_ALL_META_LONG_PULL) + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + ConsoleCheckerPath.PATH_GET_ALL_META_LONG_PULL) .queryParam("format", "xml") .queryParam("updateTime", updateTime) .build(); @@ -84,7 +85,7 @@ public XpipeMeta getXpipeAllMeta(long updateTime) throws SAXException, IOExcepti public List getAllKeeperContainers() { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/keeper_container/all").build(); ResponseEntity> resp = exchange(comp.toUri(), HttpMethod.GET, null, @@ -99,7 +100,7 @@ public boolean setConfig(ConfigModel model, Date util) { params.add("util", util); } HttpEntity> requestEntity = new HttpEntity<>(params); - ResponseEntity resp = exchange(config.getConsoleDomain() + + ResponseEntity resp = exchange(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/config/set", HttpMethod.POST, requestEntity, RetMessage.class, "setConfig"); RetMessage retMessage = resp.getBody(); return retMessage.getState() == 0; @@ -107,7 +108,7 @@ public boolean setConfig(ConfigModel model, Date util) { public ConfigTbl getConfig(String key, String subId) { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/config") .queryParam("key", key) .queryParam("subId", subId). @@ -120,7 +121,7 @@ public ConfigTbl getConfig(String key, String subId) { public List getAllConfigs(String key) { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/config/getAll/{key}").buildAndExpand(key); ResponseEntity> resp = exchange(comp.toUri(), @@ -129,7 +130,7 @@ public List getAllConfigs(String key) { } public List findAllByKeyAndValueAndUntilAfter(String key, String value, Date until) { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/config/findAll").build(); MultiValueMap params = new LinkedMultiValueMap<>(); params.add("key", key); @@ -143,7 +144,7 @@ public List findAllByKeyAndValueAndUntilAfter(String key, String valu public List getAllOrganizations() { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/organizations/all").build(); ResponseEntity> resp = exchange(comp.toUri(), HttpMethod.GET, null, @@ -153,7 +154,7 @@ public List getAllOrganizations() { public List getAllDcs() { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/dc_tbls").build(); ResponseEntity> resp = restTemplate.exchange(comp.toUri(), HttpMethod.GET, null, @@ -162,7 +163,7 @@ public List getAllDcs() { } public List findClusterRelatedDc(String clusterId) { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/clusters/" + clusterId + "/dcs").build(); ResponseEntity> resp = exchange(comp.toUri(), HttpMethod.GET, null, new ParameterizedTypeReference>(){}, "findClusterRelatedDc"); @@ -171,7 +172,7 @@ public List findClusterRelatedDc(String clusterId) { public List findAllClusters() { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/clusters/all").build(); ResponseEntity> resp = exchange(comp.toUri(), @@ -182,7 +183,7 @@ public List findAllClusters() { public List findAllTunnelInfo() { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + ConsoleCheckerPath.PATH_GET_PROXY_CHAINS).build(); ResponseEntity> resp = exchange(comp.toUri(), @@ -192,7 +193,7 @@ public List findAllTunnelInfo() { } public List findAllByDcClusterShard(long dcClusterShardId) { - UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleDomain() + + UriComponents comp = UriComponentsBuilder.fromHttpUrl(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/redis/{dcClusterShardId}").buildAndExpand(dcClusterShardId); ResponseEntity> resp = exchange(comp.toUri(), HttpMethod.GET, null, new ParameterizedTypeReference>(){}, "findAllByDcClusterShard"); @@ -201,7 +202,7 @@ public List findAllByDcClusterShard(long dcClusterShardId) { public void updateBatchKeeperActive(List redises) { HttpEntity> requestEntity = new HttpEntity<>(redises); - ResponseEntity resp = exchange(config.getConsoleDomain() + + ResponseEntity resp = exchange(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/redis/updateBatchKeeperActive", HttpMethod.POST, requestEntity, RetMessage.class, "updateBatchKeeperActive" ); @@ -225,7 +226,7 @@ public void insertRedises(String dcId, String clusterId, String shardId, List requestEntity = new HttpEntity<>(redisCreateInfo, headers); - ResponseEntity resp = exchange(config.getConsoleDomain() + + ResponseEntity resp = exchange(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/redis/insert", HttpMethod.POST, requestEntity, RetMessage.class, "insertRedises"); RetMessage retMessage = resp.getBody(); @@ -237,7 +238,7 @@ public void insertRedises(String dcId, String clusterId, String shardId, List requestEntity = new HttpEntity<>(dcClusterTbl); - ResponseEntity resp = exchange(config.getConsoleDomain() + + ResponseEntity resp = exchange(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/dc/bind", HttpMethod.POST, requestEntity, RetMessage.class, "bindDc" ); @@ -248,7 +249,7 @@ public void bindDc(DcClusterTbl dcClusterTbl) { } public List getActiveRoutes() { - ResponseEntity resp = exchange(config.getConsoleDomain() + + ResponseEntity resp = exchange(config.getConsoleNoDbDomain() + AbstractConsoleController.API_PREFIX + "/routes/active", HttpMethod.GET, null, String.class, "getActiveRoutes" ); @@ -257,9 +258,25 @@ public List getActiveRoutes() { return pretty.decode(content, List.class); } + public void updateKeeperStatus(String dcId, String clusterId, String shardId, KeeperMeta newActiveKeeper) { + try { + catTransactionMonitor.logTransaction("ConsoleForwardAPI", "updateKeeperStatus", new Callable() { + @Override + public String call() { + restTemplate.put( config.getConsoleNoDbDomain() + "/api/dc/{dcId}/cluster/{clusterId}/shard/{shardId}/keepers/adjustment", + newActiveKeeper, dcId, clusterId, shardId); + return null; + } + }); + } catch (Exception e) { + logger.error("[updateKeeperStatus]", e); + } + + } + ResponseEntity exchange(String url, HttpMethod var2, HttpEntity httpEntity, Class type, String name) { try { - return catTransactionMonitor.logTransaction("API", name, new Callable>() { + return catTransactionMonitor.logTransaction("ConsoleForwardAPI", name, new Callable>() { @Override public ResponseEntity call() { return restTemplate.exchange(url, var2, httpEntity, type); @@ -273,7 +290,7 @@ public ResponseEntity call() { ResponseEntity exchange(URI uri, HttpMethod var2, HttpEntity httpEntity, ParameterizedTypeReference type, String name) { try { - return catTransactionMonitor.logTransaction("API", name, new Callable>() { + return catTransactionMonitor.logTransaction("ConsoleForwardAPI", name, new Callable>() { @Override public ResponseEntity call() { return restTemplate.exchange(uri, var2, httpEntity, type); diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/DefaultMetaCache.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/DefaultMetaCache.java index 9acca6270..df1a3b8d0 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/DefaultMetaCache.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/DefaultMetaCache.java @@ -58,7 +58,7 @@ public class DefaultMetaCache extends AbstractMetaCache implements MetaCache, Co private KeeperContainerService keeperContainerService; @Autowired - private ConsoleConfig consoleConfig; + protected ConsoleConfig consoleConfig; @Autowired private RouteChooseStrategyFactory routeChooseStrategyFactory; @@ -71,11 +71,11 @@ public class DefaultMetaCache extends AbstractMetaCache implements MetaCache, Co private List> xmlFormatXPipeMetaParts = null; - private ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1); + protected ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1); - private ScheduledFuture future; + protected ScheduledFuture future; - private AtomicBoolean taskTrigger = new AtomicBoolean(false); + protected AtomicBoolean taskTrigger = new AtomicBoolean(false); private final Lock lock = new ReentrantLock(); protected final Condition condition = lock.newCondition(); @@ -99,7 +99,7 @@ public XpipeMeta getXpipeMetaLongPull(long updateTime) throws InterruptedExcepti XpipeMeta xpipeMeta = null; if(lock.tryLock(consoleConfig.getCacheRefreshInterval(), TimeUnit.MILLISECONDS)) { try { - if(lastUpdateTime <= updateTime) { + if(getLastUpdateTime() <= updateTime) { condition.await(consoleConfig.getCacheRefreshInterval(), TimeUnit.MILLISECONDS); } xpipeMeta = meta.getKey(); @@ -125,7 +125,6 @@ private synchronized void stopLoadMeta(){ monitor2ClusterShard = null; allKeepers = null; allKeeperSize = DEFAULT_KEEPER_NUMBERS; - lastUpdateTime = 0; } public void startLoadMeta() { diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/MetaSynchronizer.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/MetaSynchronizer.java index afdc76d67..873e5c6b1 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/MetaSynchronizer.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/resources/MetaSynchronizer.java @@ -9,7 +9,6 @@ import com.ctrip.xpipe.redis.console.sentinel.SentinelBalanceService; import com.ctrip.xpipe.redis.console.service.*; import com.ctrip.xpipe.redis.core.meta.MetaCache; -import com.ctrip.xpipe.utils.StringUtil; import com.ctrip.xpipe.utils.XpipeThreadFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,52 +87,24 @@ public void run() { }, consoleConfig.getOuterClientSyncInterval(), consoleConfig.getOuterClientSyncInterval(), TimeUnit.MILLISECONDS); } - public void sync() { - Set dcs = consoleConfig.getExtraSyncDC(); - for(String dc : dcs) { - if(consoleCrossDcServer.amILeader()) { - if(!dcMetaSynchronizers.containsKey(dc)) { - // meta.sync.external.dc 下dc 同步任务交给 cross dc leader - dcMetaSynchronizers.put(dc, new DcMetaSynchronizer(consoleConfig, metaCache, redisService, shardService, - clusterService, dcService, organizationService, sentinelBalanceService, - clusterTypeUpdateEventFactory, outerClientService, dc)); - dcMetaSynchronizers.get(dc).start(); - - } - } else { - if(dcMetaSynchronizers.containsKey(dc)) { - dcMetaSynchronizers.get(dc).stop(); - dcMetaSynchronizers.remove(dc); - } - } - - } - String currentDc = foundationService.getDataCenter(); - if(dcs.contains(currentDc)) { - if(dcMetaSynchronizers.containsKey(currentDc)) { - dcMetaSynchronizers.get(currentDc).stop(); - dcMetaSynchronizers.remove(currentDc); - } - return; - } - if(consoleLeaderElector.amILeader()) { - if(!dcMetaSynchronizers.containsKey(currentDc)) { - // 没有被cross dc leader 托管需要自己完成 - dcMetaSynchronizers.put(currentDc, new DcMetaSynchronizer(consoleConfig, metaCache, redisService, shardService, + private void processNeedAdd(Set needProcess) { + for(String dc : needProcess) { + if(!dcMetaSynchronizers.containsKey(dc)) { + // 还未加入,需要添加 + dcMetaSynchronizers.put(dc, new DcMetaSynchronizer(consoleConfig, metaCache, redisService, shardService, clusterService, dcService, organizationService, sentinelBalanceService, - clusterTypeUpdateEventFactory, outerClientService,currentDc)); - dcMetaSynchronizers.get(currentDc).start(); - } - } else { - if(dcMetaSynchronizers.containsKey(currentDc)) { - dcMetaSynchronizers.get(currentDc).stop(); - dcMetaSynchronizers.remove(currentDc); + clusterTypeUpdateEventFactory, outerClientService, dc)); + dcMetaSynchronizers.get(dc).start(); } } - // 检查 被移除托管的 dc + } + + private void processNeedRemove(Set needProcess) { Set needRemoved = new HashSet<>(); + for(String dc : dcMetaSynchronizers.keySet()) { - if(!dcs.contains(dc) && !StringUtil.trimEquals(dc, currentDc)) { + if(!needProcess.contains(dc)) { + // 不在need process集合里面需要删除 needRemoved.add(dc); } } @@ -144,4 +115,27 @@ public void sync() { } } + private void updateTasks(Set needProcess) { + processNeedAdd(needProcess); + processNeedRemove(needProcess); + } + + + public void sync() { + + Set dcs = consoleConfig.getExtraSyncDC(); + String currentDc = foundationService.getDataCenter(); + Set needProcess = new HashSet<>(); + + if(consoleCrossDcServer.amILeader()) { + needProcess.addAll(dcs); + needProcess.add(currentDc); + } else { + if(consoleLeaderElector.amILeader() && !consoleConfig.disableDb()) { + needProcess.add(currentDc); + } + } + updateTasks(needProcess); + } + } diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/AdvancedDcMetaService.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/AdvancedDcMetaService.java index 9746702fd..90d687f09 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/AdvancedDcMetaService.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/AdvancedDcMetaService.java @@ -143,7 +143,11 @@ public DcMeta getDcMeta(String dcName, Set allowTypes) throws Exception } ZoneTbl zoneTbl = zoneService.findById(dcTbl.getZoneId()); - DcMeta dcMeta = new DcMeta().setId(dcName).setLastModifiedTime(dcTbl.getDcLastModifiedTime()).setZone(zoneTbl.getZoneName()); + DcMeta dcMeta = new DcMeta(). + setId(dcName). + setLastModifiedTime(dcTbl.getDcLastModifiedTime()). + setZone(zoneTbl.getZoneName()) + .setDcId(dcTbl.getId()); Map dcMetaMap = new HashMap<>(); dcMetaMap.put(dcMeta.getId().toUpperCase(), dcMeta); diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/RedisMetaServiceImpl.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/RedisMetaServiceImpl.java index bc44cfb16..b020391ff 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/RedisMetaServiceImpl.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/RedisMetaServiceImpl.java @@ -1,5 +1,7 @@ package com.ctrip.xpipe.redis.console.service.meta.impl; +import com.ctrip.xpipe.redis.checker.spring.ConsoleDisableDbCondition; +import com.ctrip.xpipe.redis.checker.spring.DisableDbMode; import com.ctrip.xpipe.redis.console.constant.XPipeConsoleConstant; import com.ctrip.xpipe.redis.console.dao.RedisDao; import com.ctrip.xpipe.redis.console.model.RedisTbl; @@ -11,6 +13,7 @@ import com.ctrip.xpipe.redis.core.entity.RedisMeta; import com.ctrip.xpipe.redis.core.entity.ShardMeta; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -22,6 +25,8 @@ * Aug 17, 2016 */ @Service +@Conditional(ConsoleDisableDbCondition.class) +@DisableDbMode(false) public class RedisMetaServiceImpl extends AbstractMetaService implements RedisMetaService { public static long REDIS_MASTER_NULL = 0L; diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/RedisMetaServiceWithoutDB.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/RedisMetaServiceWithoutDB.java new file mode 100644 index 000000000..efcb4f4f3 --- /dev/null +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/meta/impl/RedisMetaServiceWithoutDB.java @@ -0,0 +1,23 @@ +package com.ctrip.xpipe.redis.console.service.meta.impl; + +import com.ctrip.xpipe.redis.checker.spring.ConsoleDisableDbCondition; +import com.ctrip.xpipe.redis.checker.spring.DisableDbMode; +import com.ctrip.xpipe.redis.console.resources.ConsolePortalService; +import com.ctrip.xpipe.redis.core.entity.KeeperMeta; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Conditional; +import org.springframework.stereotype.Service; + +@Service +@Conditional(ConsoleDisableDbCondition.class) +@DisableDbMode(true) +public class RedisMetaServiceWithoutDB extends RedisMetaServiceImpl { + + @Autowired + private ConsolePortalService consolePortalService; + + @Override + public void updateKeeperStatus(String dcId, String clusterId, String shardId, KeeperMeta newActiveKeeper) { + consolePortalService.updateKeeperStatus(dcId, clusterId, shardId, newActiveKeeper); + } +} diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/CheckerContextConfig.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/CheckerContextConfig.java index daac3caa7..7f655e8ea 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/CheckerContextConfig.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/CheckerContextConfig.java @@ -19,7 +19,7 @@ import com.ctrip.xpipe.redis.checker.spring.ConsoleServerMode; import com.ctrip.xpipe.redis.checker.spring.ConsoleServerModeCondition; import com.ctrip.xpipe.redis.console.config.ConsoleConfig; -import com.ctrip.xpipe.redis.console.config.impl.CombConsoleConfig; +import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleConfig; import com.ctrip.xpipe.redis.console.config.impl.DefaultCommonConfig; import com.ctrip.xpipe.redis.console.healthcheck.meta.DcIgnoredConfigChangeListener; import com.ctrip.xpipe.redis.console.migration.auto.DefaultBeaconManager; @@ -105,7 +105,7 @@ public CheckerConfig checkerConfig(CheckConfigBean checkConfigBean, ConsoleConfigBean consoleConfigBean, DataCenterConfigBean dataCenterConfigBean, CommonConfigBean commonConfigBean) { - return new CombConsoleConfig(checkConfigBean, consoleConfigBean, dataCenterConfigBean, commonConfigBean); + return new DefaultConsoleConfig(checkConfigBean, consoleConfigBean, dataCenterConfigBean, commonConfigBean); } @Bean diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/ConsoleContextConfig.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/ConsoleContextConfig.java index 0d3de1fca..e44af4af3 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/ConsoleContextConfig.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/spring/ConsoleContextConfig.java @@ -20,7 +20,7 @@ import com.ctrip.xpipe.redis.console.cluster.ConsoleLeaderElector; import com.ctrip.xpipe.redis.console.config.ConsoleConfig; import com.ctrip.xpipe.redis.console.config.ConsoleDbConfig; -import com.ctrip.xpipe.redis.console.config.impl.CombConsoleConfig; +import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleConfig; import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleDbConfig; import com.ctrip.xpipe.redis.console.dao.ClusterDao; import com.ctrip.xpipe.redis.console.dao.ConfigDao; @@ -44,7 +44,6 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.context.annotation.*; -import org.springframework.stereotype.Service; /** @@ -91,7 +90,7 @@ public FilterRegistrationBean userAccessFilter(ConsoleConfig consoleConfig) { @Profile(AbstractProfile.PROFILE_NAME_PRODUCTION) public MetaCache metaCache(ConsolePortalService consolePortalService, ConsoleConfig config) { if(config.disableDb()) { - return new ConsoleMetaCacheWithoutDB(consolePortalService); + return new ConsoleMetaCacheWithoutDB(consolePortalService, config); } return new DefaultMetaCache(); } @@ -110,7 +109,7 @@ public MetaCache testMetaCache() { @Bean public ConsoleConfig consoleConfig(FoundationService foundationService) { - return new CombConsoleConfig( + return new DefaultConsoleConfig( new CheckConfigBean(foundationService), new ConsoleConfigBean(foundationService), new DataCenterConfigBean(), diff --git a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/AbstractConsoleTest.java b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/AbstractConsoleTest.java index 611591489..718cf2014 100644 --- a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/AbstractConsoleTest.java +++ b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/AbstractConsoleTest.java @@ -7,7 +7,7 @@ import com.ctrip.xpipe.redis.checker.config.impl.CommonConfigBean; import com.ctrip.xpipe.redis.checker.config.impl.ConsoleConfigBean; import com.ctrip.xpipe.redis.checker.config.impl.DataCenterConfigBean; -import com.ctrip.xpipe.redis.console.config.impl.CombConsoleConfig; +import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleConfig; import org.junit.BeforeClass; /** @@ -25,7 +25,7 @@ public static void beforeAbstractConsoleTest() { @Override protected CheckerConfig buildCheckerConfig() { - return new CombConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), + return new DefaultConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), new ConsoleConfigBean(FoundationService.DEFAULT), new DataCenterConfigBean(), new CommonConfigBean()); diff --git a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfigTest.java b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfigTest.java index 83a5227a6..57fdb9516 100644 --- a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfigTest.java +++ b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/config/impl/DefaultConsoleConfigTest.java @@ -24,11 +24,11 @@ */ public class DefaultConsoleConfigTest extends AbstractConsoleTest { - private CombConsoleConfig consoleConfig; + private DefaultConsoleConfig consoleConfig; @Before public void beforeDefaultConsoleConfigTest() { - consoleConfig = new CombConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), + consoleConfig = new DefaultConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), new ConsoleConfigBean(FoundationService.DEFAULT), new DataCenterConfigBean(), new CommonConfigBean()); diff --git a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/controller/consoleportal/migration/ExclusiveThreadsForMigrationTest.java b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/controller/consoleportal/migration/ExclusiveThreadsForMigrationTest.java index afd1f149d..39f75628e 100644 --- a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/controller/consoleportal/migration/ExclusiveThreadsForMigrationTest.java +++ b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/controller/consoleportal/migration/ExclusiveThreadsForMigrationTest.java @@ -10,7 +10,7 @@ import com.ctrip.xpipe.redis.checker.config.impl.DataCenterConfigBean; import com.ctrip.xpipe.redis.console.AbstractConsoleTest; import com.ctrip.xpipe.redis.console.config.ConsoleConfig; -import com.ctrip.xpipe.redis.console.config.impl.CombConsoleConfig; +import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleConfig; import com.ctrip.xpipe.redis.console.controller.api.migrate.MigrationApi4Beacon; import com.ctrip.xpipe.redis.console.controller.api.migrate.meta.BeaconMigrationRequest; import com.ctrip.xpipe.redis.console.controller.api.migrate.meta.BeaconMigrationResponse; @@ -88,7 +88,7 @@ public CommandFuture biMigrate(BeaconMigrationRequest migrationRequest) { @Bean public ConsoleConfig consoleConfig() { - return new CombConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), + return new DefaultConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), new ConsoleConfigBean(FoundationService.DEFAULT), new DataCenterConfigBean(), new CommonConfigBean()); diff --git a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/health/ContextConfig.java b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/health/ContextConfig.java index 0d8b124c0..a8396227e 100644 --- a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/health/ContextConfig.java +++ b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/health/ContextConfig.java @@ -6,7 +6,7 @@ import com.ctrip.xpipe.redis.checker.config.impl.ConsoleConfigBean; import com.ctrip.xpipe.redis.checker.config.impl.DataCenterConfigBean; import com.ctrip.xpipe.redis.console.config.ConsoleConfig; -import com.ctrip.xpipe.redis.console.config.impl.CombConsoleConfig; +import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleConfig; import com.ctrip.xpipe.redis.console.util.DefaultMetaServerConsoleServiceManagerWrapper; import com.ctrip.xpipe.redis.console.util.MetaServerConsoleServiceManagerWrapper; import com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleServiceManager; @@ -41,7 +41,7 @@ public MetaServerConsoleServiceManagerWrapper getMetaServerConsoleServiceManager @Bean public ConsoleConfig consoleConfig() { - return new CombConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), + return new DefaultConsoleConfig(new CheckConfigBean(FoundationService.DEFAULT), new ConsoleConfigBean(FoundationService.DEFAULT), new DataCenterConfigBean(), new CommonConfigBean()); diff --git a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/healthcheck/nonredis/redisconfig/RedisConfigCheckMonitorTest.java b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/healthcheck/nonredis/redisconfig/RedisConfigCheckMonitorTest.java index c2d905a63..dcdde5e51 100644 --- a/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/healthcheck/nonredis/redisconfig/RedisConfigCheckMonitorTest.java +++ b/redis/redis-console/src/test/java/com/ctrip/xpipe/redis/console/healthcheck/nonredis/redisconfig/RedisConfigCheckMonitorTest.java @@ -1,7 +1,7 @@ package com.ctrip.xpipe.redis.console.healthcheck.nonredis.redisconfig; import com.ctrip.xpipe.cluster.ClusterType; -import com.ctrip.xpipe.redis.console.config.impl.CombConsoleConfig; +import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleConfig; import com.ctrip.xpipe.redis.console.controller.api.data.meta.DcClusterCreateInfo; import com.ctrip.xpipe.redis.console.service.impl.DcClusterServiceImpl; import com.ctrip.xpipe.redis.console.service.impl.DcServiceImpl; @@ -39,7 +39,7 @@ public class RedisConfigCheckMonitorTest { DcServiceImpl dcService; @Mock - CombConsoleConfig consoleConfig; + DefaultConsoleConfig consoleConfig; private ClusterType mockClusterType = ClusterType.BI_DIRECTION; diff --git a/redis/redis-core/src/main/java/com/ctrip/xpipe/redis/core/console/ConsoleCheckerPath.java b/redis/redis-core/src/main/java/com/ctrip/xpipe/redis/core/console/ConsoleCheckerPath.java index 16f01e071..67e431b5d 100644 --- a/redis/redis-core/src/main/java/com/ctrip/xpipe/redis/core/console/ConsoleCheckerPath.java +++ b/redis/redis-core/src/main/java/com/ctrip/xpipe/redis/core/console/ConsoleCheckerPath.java @@ -12,7 +12,7 @@ private ConsoleCheckerPath() {} public static final String PATH_GET_ALL_META = "/api/meta/divide"; - public static final String PATH_GET_ALL_META_LONG_PULL = "/api/meta/divide/long"; + public static final String PATH_GET_ALL_META_LONG_PULL = "/api/meta/long_pull"; public static final String PATH_GET_DC_ALL_META = "/api/meta/{dcName}/all"; diff --git a/redis/redis-core/src/main/resources/META-INF/dal/model/keeper-codegen.xml b/redis/redis-core/src/main/resources/META-INF/dal/model/keeper-codegen.xml index 719411f1f..b8b550a35 100644 --- a/redis/redis-core/src/main/resources/META-INF/dal/model/keeper-codegen.xml +++ b/redis/redis-core/src/main/resources/META-INF/dal/model/keeper-codegen.xml @@ -4,6 +4,7 @@ + diff --git a/redis/redis-integration-test/src/test/java/com/ctrip/xpipe/redis/integratedtest/console/config/SpringEnvConsoleConfig.java b/redis/redis-integration-test/src/test/java/com/ctrip/xpipe/redis/integratedtest/console/config/SpringEnvConsoleConfig.java index 5bf7d9470..c2015ece7 100644 --- a/redis/redis-integration-test/src/test/java/com/ctrip/xpipe/redis/integratedtest/console/config/SpringEnvConsoleConfig.java +++ b/redis/redis-integration-test/src/test/java/com/ctrip/xpipe/redis/integratedtest/console/config/SpringEnvConsoleConfig.java @@ -5,12 +5,12 @@ import com.ctrip.xpipe.redis.checker.config.impl.CommonConfigBean; import com.ctrip.xpipe.redis.checker.config.impl.ConsoleConfigBean; import com.ctrip.xpipe.redis.checker.config.impl.DataCenterConfigBean; -import com.ctrip.xpipe.redis.console.config.impl.CombConsoleConfig; +import com.ctrip.xpipe.redis.console.config.impl.DefaultConsoleConfig; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; -public class SpringEnvConsoleConfig extends CombConsoleConfig implements ApplicationContextAware { +public class SpringEnvConsoleConfig extends DefaultConsoleConfig implements ApplicationContextAware { public SpringEnvConsoleConfig() { super(new CheckConfigBean(FoundationService.DEFAULT),