diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/RedisSessionServiceImpl.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/RedisSessionServiceImpl.java index ae2b52c97..cd80c4bf6 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/RedisSessionServiceImpl.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/RedisSessionServiceImpl.java @@ -11,8 +11,6 @@ import com.ctrip.xpipe.redis.core.meta.MetaCache; import com.ctrip.xpipe.redis.core.protocal.pojo.AbstractRole; import com.ctrip.xpipe.redis.core.protocal.pojo.Role; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -20,9 +18,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; +import java.util.concurrent.*; @Component @@ -42,31 +38,32 @@ public CommandFuture getRedisRole(String ip, int port, RedisSession.RollCa @Override public List getShardAllRedisRole(String dcId, String clusterId, String shardId) { List redisOfDcClusterShard = metaCache.getRedisOfDcClusterShard(dcId, clusterId, shardId); - List models = new CopyOnWriteArrayList<>(); + Map models = new ConcurrentHashMap<>(); Map> futureMap = new HashMap<>(); redisOfDcClusterShard.forEach(redisMeta -> { + HostPort redis = new HostPort(redisMeta.getIp(), redisMeta.getPort()); CommandFuture redisRole = getRedisRole(redisMeta.getIp(), redisMeta.getPort(), new RedisSession.RollCallback() { @Override public void role(String role, Role detail) { - models.add(new RedisRoleModel(redisMeta.getIp(), redisMeta.getPort(), (AbstractRole) detail)); + models.put(redis, new RedisRoleModel(redisMeta.getIp(), redisMeta.getPort(), (AbstractRole) detail)); } @Override public void fail(Throwable e) { - models.add(new RedisRoleModel(redisMeta.getIp(), redisMeta.getPort(),e)); + models.put(redis, new RedisRoleModel(redisMeta.getIp(), redisMeta.getPort(),e)); } }); - futureMap.put(new HostPort(redisMeta.getIp(), redisMeta.getPort()), redisRole); + futureMap.put(redis, redisRole); }); for (Map.Entry> entry : futureMap.entrySet()) { try { entry.getValue().get(); } catch (InterruptedException | ExecutionException e) { - models.add(new RedisRoleModel(entry.getKey().getHost(), entry.getKey().getPort(), e)); + models.put(entry.getKey(), new RedisRoleModel(entry.getKey().getHost(), entry.getKey().getPort(), e)); } } - return models; + return new ArrayList<>(models.values()); } } diff --git a/redis/redis-console/src/main/resources/static/dist/bundle.js b/redis/redis-console/src/main/resources/static/dist/bundle.js index aa507c383..05fa59750 100644 --- a/redis/redis-console/src/main/resources/static/dist/bundle.js +++ b/redis/redis-console/src/main/resources/static/dist/bundle.js @@ -9153,7 +9153,7 @@ eval("angular\n .module('index')\n .controller('DcListCtl', DcListCtl);\nD \*******************************************************/ /***/ (() => { -eval("angular\n .module('index')\n .controller('FullLinkHealthCheckCtl', FullLinkHealthCheckCtl)\n .config(function ($mdThemingProvider) {\n $mdThemingProvider.theme('green').backgroundPalette('light-green');\n $mdThemingProvider.theme('red').backgroundPalette('red');\n $mdThemingProvider.theme('orange').backgroundPalette('orange');\n});\nFullLinkHealthCheckCtl.$inject = ['$rootScope', '$scope', '$window', '$stateParams', 'HealthCheckService',\n 'toastr', 'NgTableParams', 'AppUtil', '$interval'];\nfunction FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, HealthCheckService, toastr, NgTableParams, $interval) {\n $scope.masterRoles = [];\n $scope.slaveRoles = [];\n $scope.shardCheckerHealthCheckResult = [];\n $scope.showActions = false;\n $scope.shardAllMeta = null;\n $scope.shardKeeperState = [];\n $scope.redisRoleHealthCheck = redisRoleHealthCheck;\n $scope.shardCheckerGroupHealthCheck = shardCheckerGroupHealthCheck;\n $scope.doShowActions = doShowActions;\n $scope.getShardAllMeta = getShardAllMeta;\n $scope.getShardKeeperState = getShardKeeperState;\n redisRoleHealthCheck();\n shardCheckerGroupHealthCheck();\n getShardAllMeta();\n getShardKeeperState();\n function redisRoleHealthCheck() {\n HealthCheckService.getShardRedisRole($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.masterRoles = [];\n $scope.slaveRoles = [];\n response.forEach(function (item) {\n if (item.role.serverRole == \"SLAVE\") {\n $scope.slaveRoles.push(item);\n }\n else {\n $scope.masterRoles.push(item);\n }\n });\n });\n }\n function shardCheckerGroupHealthCheck() {\n HealthCheckService.getShardCheckerHealthCheck($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.shardCheckerHealthCheckResult = [];\n response.forEach(function (item) {\n $scope.shardCheckerHealthCheckResult.push(item);\n });\n });\n }\n function getShardAllMeta() {\n HealthCheckService.getShardAllMeta($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.shardAllMeta = null;\n $scope.shardAllMeta = response;\n });\n }\n function getShardKeeperState() {\n HealthCheckService.getShardKeeperState($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.shardKeeperState = [];\n response.forEach(function (item) {\n $scope.shardKeeperState.push(item);\n });\n });\n }\n function doShowActions() {\n $scope.showActions = !$scope.showActions;\n }\n}\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/controllers/FullLinkHealthCheckCtl.ts?"); +eval("angular\n .module('index')\n .controller('FullLinkHealthCheckCtl', FullLinkHealthCheckCtl)\n .config(function ($mdThemingProvider) {\n $mdThemingProvider.theme('green').backgroundPalette('light-green');\n $mdThemingProvider.theme('red').backgroundPalette('red');\n $mdThemingProvider.theme('orange').backgroundPalette('orange');\n});\nFullLinkHealthCheckCtl.$inject = ['$rootScope', '$scope', '$window', '$stateParams', 'HealthCheckService',\n 'toastr', 'NgTableParams', 'AppUtil', '$interval'];\nfunction FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, HealthCheckService, toastr, NgTableParams, $interval) {\n $scope.masterRoles = [];\n $scope.slaveRoles = [];\n $scope.unknownRoles = [];\n $scope.shardCheckerHealthCheckResult = [];\n $scope.showActions = false;\n $scope.shardAllMeta = null;\n $scope.shardKeeperState = [];\n $scope.redisRoleHealthCheck = redisRoleHealthCheck;\n $scope.shardCheckerGroupHealthCheck = shardCheckerGroupHealthCheck;\n $scope.doShowActions = doShowActions;\n $scope.getShardAllMeta = getShardAllMeta;\n $scope.getShardKeeperState = getShardKeeperState;\n redisRoleHealthCheck();\n shardCheckerGroupHealthCheck();\n getShardAllMeta();\n getShardKeeperState();\n function redisRoleHealthCheck() {\n HealthCheckService.getShardRedisRole($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.masterRoles = [];\n $scope.slaveRoles = [];\n $scope.unknownRoles = [];\n response.forEach(function (item) {\n if (item.role == null) {\n $scope.unknownRoles.push(item);\n }\n else if (item.role.serverRole == \"SLAVE\") {\n $scope.slaveRoles.push(item);\n }\n else if (item.role.serverRole == \"MASTER\") {\n $scope.masterRoles.push(item);\n }\n });\n });\n }\n function shardCheckerGroupHealthCheck() {\n HealthCheckService.getShardCheckerHealthCheck($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.shardCheckerHealthCheckResult = [];\n response.forEach(function (item) {\n $scope.shardCheckerHealthCheckResult.push(item);\n });\n });\n }\n function getShardAllMeta() {\n HealthCheckService.getShardAllMeta($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.shardAllMeta = null;\n $scope.shardAllMeta = response;\n });\n }\n function getShardKeeperState() {\n HealthCheckService.getShardKeeperState($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) {\n $scope.shardKeeperState = [];\n response.forEach(function (item) {\n $scope.shardKeeperState.push(item);\n });\n });\n }\n function doShowActions() {\n $scope.showActions = !$scope.showActions;\n }\n}\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/controllers/FullLinkHealthCheckCtl.ts?"); /***/ }), diff --git a/redis/redis-console/src/main/resources/static/scripts/controllers/FullLinkHealthCheckCtl.ts b/redis/redis-console/src/main/resources/static/scripts/controllers/FullLinkHealthCheckCtl.ts index efab339f1..61c17587a 100644 --- a/redis/redis-console/src/main/resources/static/scripts/controllers/FullLinkHealthCheckCtl.ts +++ b/redis/redis-console/src/main/resources/static/scripts/controllers/FullLinkHealthCheckCtl.ts @@ -14,6 +14,7 @@ function FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, Healt toastr, NgTableParams, $interval) { $scope.masterRoles = []; $scope.slaveRoles = []; + $scope.unknownRoles = []; $scope.shardCheckerHealthCheckResult = []; $scope.showActions=false; $scope.shardAllMeta = null; @@ -34,10 +35,13 @@ function FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, Healt HealthCheckService.getShardRedisRole($stateParams.currentDcName, $stateParams.clusterName, $stateParams.shardName).then(function (response) { $scope.masterRoles = []; $scope.slaveRoles = []; + $scope.unknownRoles = []; response.forEach(function (item){ - if (item.role.serverRole == "SLAVE") { + if (item.role == null) { + $scope.unknownRoles.push(item) + }else if (item.role.serverRole == "SLAVE") { $scope.slaveRoles.push(item); - } else { + } else if (item.role.serverRole == "MASTER") { $scope.masterRoles.push(item); } }) diff --git a/redis/redis-console/src/main/resources/static/views/index/full_link_health_check.html b/redis/redis-console/src/main/resources/static/views/index/full_link_health_check.html index 960baf970..caffec215 100644 --- a/redis/redis-console/src/main/resources/static/views/index/full_link_health_check.html +++ b/redis/redis-console/src/main/resources/static/views/index/full_link_health_check.html @@ -20,7 +20,7 @@ -
{{master.err}}
+
{{master.err.message}}
{{master.host}}:{{master.port}} {{master.role.serverRole}} @@ -48,7 +48,7 @@ -
{{slave.err}}
+
{{slave.err.message}}
{{slave.host}}:{{slave.port}} {{slave.role.serverRole}} @@ -68,6 +68,18 @@
+
+ + + +
{{redis.err.message}}
+
+ {{redis.host}}:{{redis.port}} +
+
+
+
+
@@ -104,7 +116,7 @@
replBacklogSize: - {{keeper.replBacklogSize/1024/1024 | number:2}}G + {{keeper.replBacklogSize/1024/1024/1024 | number:2}}G
@@ -172,7 +184,7 @@ -
{{shardAllMeta.err}}
+
{{shardAllMeta.err.message}}
Meta {{shardAllMeta.metaHost}}:{{shardAllMeta.metaPort}}