diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java index e33976b47..212304e6d 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/api/KeeperContainerController.java @@ -7,15 +7,13 @@ import com.ctrip.xpipe.redis.console.controller.AbstractConsoleController; import com.ctrip.xpipe.redis.console.keeper.KeeperContainerUsedInfoAnalyzer; import com.ctrip.xpipe.redis.console.model.ConfigModel; +import com.ctrip.xpipe.redis.console.model.KeeperRestElectionModel; import com.ctrip.xpipe.redis.console.model.MigrationKeeperContainerDetailModel; import com.ctrip.xpipe.redis.console.service.ConfigService; +import com.ctrip.xpipe.redis.console.service.KeeperService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,6 +31,9 @@ public class KeeperContainerController extends AbstractConsoleController{ @Autowired ConfigService configService; + @Autowired + KeeperService keeperService; + @RequestMapping(value = "/keepercontainer/overload/info/all", method = RequestMethod.GET) public List getAllReadyToMigrateKeeperContainers() { return analyzer.getCurrentDcReadyToMigrationKeeperContainers(); @@ -93,5 +94,14 @@ public RetMessage getIORate() { } } + @RequestMapping(value = "/keepers/election/reset", method = RequestMethod.POST) + public RetMessage resetElection(@RequestBody KeeperRestElectionModel model){ + try { + keeperService.resetElection(model.getIp(), Integer.parseInt(model.getPort()), Long.parseLong(model.getShardId())); + return RetMessage.createSuccessMessage(); + } catch (Throwable th) { + return RetMessage.createFailMessage(th.getMessage()); + } + } } diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/model/KeeperRestElectionModel.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/model/KeeperRestElectionModel.java new file mode 100644 index 000000000..32c54eb08 --- /dev/null +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/model/KeeperRestElectionModel.java @@ -0,0 +1,42 @@ +package com.ctrip.xpipe.redis.console.model; + + +public class KeeperRestElectionModel { + + private String ip; + private String port; + private String shardId; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getShardId() { + return shardId; + } + + public void setShardId(String shardId) { + this.shardId = shardId; + } + + @Override + public String toString() { + return "KeeperRestElectionModel{" + + "ip='" + ip + '\'' + + ", port=" + port + + ", shardId=" + shardId + + '}'; + } +} diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/KeeperService.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/KeeperService.java index f1fe31e7a..27205c509 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/KeeperService.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/KeeperService.java @@ -9,4 +9,7 @@ */ public interface KeeperService { boolean isKeeper(HostPort hostPort); + + void resetElection(String keeperIp, int port, long shardId) throws Exception; + } diff --git a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/KeeperServiceImpl.java b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/KeeperServiceImpl.java index 3d07c6037..e5e3ad35e 100644 --- a/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/KeeperServiceImpl.java +++ b/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/service/impl/KeeperServiceImpl.java @@ -1,12 +1,18 @@ package com.ctrip.xpipe.redis.console.service.impl; import com.ctrip.xpipe.endpoint.HostPort; -import com.ctrip.xpipe.redis.console.config.ConsoleConfig; +import com.ctrip.xpipe.redis.console.keeper.command.KeeperResetCommand; +import com.ctrip.xpipe.redis.console.service.KeeperContainerService; import com.ctrip.xpipe.redis.core.meta.MetaCache; import com.ctrip.xpipe.redis.console.service.KeeperService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.concurrent.ScheduledExecutorService; + +import static com.ctrip.xpipe.redis.checker.resource.Resource.REDIS_COMMAND_EXECUTOR; + /** * @author chen.zhu @@ -20,10 +26,18 @@ public class KeeperServiceImpl implements KeeperService { MetaCache metaCache; @Autowired - ConsoleConfig consoleConfig; + private KeeperContainerService keeperContainerService; + + @Resource(name = REDIS_COMMAND_EXECUTOR) + private ScheduledExecutorService scheduled; @Override public boolean isKeeper(HostPort hostPort) { return metaCache.getAllKeepers().contains(hostPort); } + + @Override + public void resetElection(String keeperIp, int port, long shardId) throws Exception { + new KeeperResetCommand<>(keeperIp, shardId, keeperContainerService).execute(scheduled).get(); + } } 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 b62119c4d..5a37c4597 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.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?"); +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', 'KeeperContainerService',\n 'toastr', 'NgTableParams', 'AppUtil', '$interval'];\nfunction FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, HealthCheckService, KeeperContainerService, 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 $scope.resetElection = resetElection;\n $scope.ableResetElection = false;\n $scope.getAbleResetElection = getAbleResetElection;\n $scope.resetElectionErr = null;\n $scope.getResetElectionErr = getResetElectionErr;\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 resetElection(ip, port) {\n $scope.ableResetElection = true;\n console.log(ip + \":\" + port + \"-\" + $stateParams.shardId);\n KeeperContainerService.resetElection(ip, port, 1).then(function (response) {\n $scope.ableResetElection = false;\n if (response.state != 0) {\n $scope.resetElectionErr = response.message;\n $('#resetElectionErr').modal('show');\n }\n else {\n getShardKeeperState();\n }\n }).catch(function (error) {\n $scope.resetElectionErr = error.status + \" \" + error.statusText;\n $scope.ableResetElection = false;\n $('#resetElectionErr').modal('show');\n });\n }\n function getResetElectionErr() {\n return $scope.resetElectionErr;\n }\n function doShowActions() {\n $scope.showActions = !$scope.showActions;\n }\n function getAbleResetElection() {\n return $scope.ableResetElection;\n }\n}\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/controllers/FullLinkHealthCheckCtl.ts?"); /***/ }), @@ -9453,7 +9453,7 @@ eval("angular\n .module('services')\n .service('DcService', DcService);\nD \************************************************/ /***/ (() => { -eval("angular\n .module('services')\n .service('HealthCheckService', HealthCheckService);\nHealthCheckService.$inject = ['$resource', '$q'];\nfunction HealthCheckService($resource, $q) {\n var IS_REDIS_HEALTH = \"is_redis_health\";\n var GET_REPL_DELAY = \"get_repl_delay\";\n var GET_SHARD_DELAY = \"get_shard_delay\";\n var GET_HICKWALL_ADDR = \"get_hickwall_addr\";\n var GET_HETERO_HICKWALL_ADDR = \"get_hetero_hickwall_addr\";\n var GET_CROSS_MASTER_DELAY = \"get_cross_master_delay\";\n var GET_CROSS_MASTER_HICKWALL_ADDR = \"get_cross_master_hickwall_addr\";\n var GET_PEER_OUTCOMING = \"get_peer_outcoming\";\n var GET_PEER_INCOMING = \"get_peer_incoming\";\n var GET_PEER_FULL_SYNC = \"get_peer_full_sync\";\n var GET_PEER_PARTIAL_SYNC = \"get_peer_partial_sync\";\n var GET_SHARD_REDIS_ROLE = \"get_shard_redis_role\";\n var GET_SHARD_KEEPER_STATE = \"get_shard_keeper_state\";\n var GET_SHARD_CHECKER_HEALTH_CHECK = \"get_shard_checker_health_check\";\n var GET_SHARD_ALL_META = \"get_shard_all_meta\";\n var apis = (function initResourceParam() {\n var apis = {};\n apis[IS_REDIS_HEALTH] = {\n method: 'GET',\n url: '/console/redis/health/:redisIp/:redisPort'\n };\n apis[GET_REPL_DELAY] = {\n method: 'GET',\n url: '/console/redis/delay/:clusterType/:redisIp/:redisPort'\n };\n apis[GET_SHARD_DELAY] = {\n method: 'GET',\n url: '/console/shard/delay/:clusterId/:shardId/:shardDbId'\n };\n apis[GET_HICKWALL_ADDR] = {\n method: 'GET',\n url: '/console/redis/health/hickwall/:cluster/:shard/:redisIp/:redisPort/:delayType'\n };\n apis[GET_HETERO_HICKWALL_ADDR] = {\n method: 'GET',\n url: '/console/hetero/health/hickwall/:cluster/:srcShardId/:delayType'\n };\n apis[GET_CROSS_MASTER_DELAY] = {\n method: 'GET',\n url: '/console/cross-master/delay/:clusterType/:dc/:cluster/:shard'\n };\n apis[GET_CROSS_MASTER_HICKWALL_ADDR] = {\n method: 'GET',\n url: '/console/cross-master/health/hickwall/:cluster/:shard/:sourceDc/:destDc'\n };\n apis[GET_PEER_OUTCOMING] = {\n method: 'GET',\n url: '/console/redis/outcoming/traffic/to/peer/hickwall/:redisIp/:redisPort'\n };\n apis[GET_PEER_INCOMING] = {\n method: 'GET',\n url: '/console/redis/incoming/traffic/from/peer/hickwall/:redisIp/:redisPort'\n };\n apis[GET_PEER_FULL_SYNC] = {\n method: 'GET',\n url: '/console/redis/peer/sync/full/hickwall/:redisIp/:redisPort'\n };\n apis[GET_PEER_PARTIAL_SYNC] = {\n method: 'GET',\n url: '/console/redis/peer/sync/partial/hickwall/:redisIp/:redisPort'\n };\n apis[GET_SHARD_REDIS_ROLE] = {\n method: 'GET',\n url: '/api/redis/role/:dcId/:clusterId/:shardId',\n isArray: true\n };\n apis[GET_SHARD_KEEPER_STATE] = {\n method: 'GET',\n url: '/api/keeper/states/:dcId/:clusterId/:shardId',\n isArray: true\n };\n apis[GET_SHARD_CHECKER_HEALTH_CHECK] = {\n method: 'GET',\n url: '/api/checker/groups/:dcId/:clusterId/:shardId',\n isArray: true\n };\n apis[GET_SHARD_ALL_META] = {\n method: 'GET',\n url: '/api/meta/all/:dcId/:clusterId/:shardId'\n };\n return apis;\n })();\n var resource = $resource('', {}, apis);\n function request(q, method, params) {\n resource[method](params, function (result) {\n q.resolve(result);\n }, function (result) {\n q.reject(result);\n });\n return q.promise;\n }\n function isRedisHealth(ip, port) {\n return request($q.defer(), IS_REDIS_HEALTH, {\n redisIp: ip,\n redisPort: port\n });\n }\n function getReplDelay(ip, port, clusterType) {\n return request($q.defer(), GET_REPL_DELAY, {\n clusterType: clusterType,\n redisIp: ip,\n redisPort: port\n });\n }\n function getShardDelay(clusterId, shardId, shardDbId) {\n return request($q.defer(), GET_SHARD_DELAY, {\n clusterId: clusterId,\n shardId: shardId,\n shardDbId: shardDbId\n });\n }\n function getHickwallAddr(cluster, shard, redisIp, redisPort, delayType) {\n return request($q.defer(), GET_HICKWALL_ADDR, {\n cluster: cluster,\n shard: shard,\n redisIp: redisIp,\n redisPort: redisPort,\n delayType: delayType\n });\n }\n function getHeteroHickwallAddr(cluster, srcShardId, delayType) {\n return request($q.defer(), GET_HETERO_HICKWALL_ADDR, {\n cluster: cluster,\n srcShardId: srcShardId,\n delayType: delayType\n });\n }\n function getCrossMasterDelay(dc, cluster, shard, clusterType) {\n return request($q.defer(), GET_CROSS_MASTER_DELAY, {\n dc: dc, cluster: cluster, shard: shard, clusterType: clusterType\n });\n }\n function getCrossMasterHickwallAddr(cluster, shard, sourceDc, destDc) {\n return request($q.defer(), GET_CROSS_MASTER_HICKWALL_ADDR, {\n cluster: cluster, shard: shard, sourceDc: sourceDc, destDc: destDc\n });\n }\n function getOutComingTrafficToPeerHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_OUTCOMING, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getInComingTrafficFromPeerHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_INCOMING, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getPeerSyncFullHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_FULL_SYNC, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getPeerSyncPartialHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_PARTIAL_SYNC, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getShardRedisRole(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_REDIS_ROLE, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n function getShardKeeperState(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_KEEPER_STATE, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n function getShardCheckerHealthCheck(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_CHECKER_HEALTH_CHECK, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n function getShardAllMeta(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_ALL_META, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n return {\n isRedisHealth: isRedisHealth,\n getReplDelay: getReplDelay,\n getShardDelay: getShardDelay,\n getHickwallAddr: getHickwallAddr,\n getHeteroHickwallAddr: getHeteroHickwallAddr,\n getCrossMasterDelay: getCrossMasterDelay,\n getCrossMasterHickwallAddr: getCrossMasterHickwallAddr,\n getOutComingTrafficToPeerHickwallAddr: getOutComingTrafficToPeerHickwallAddr,\n getInComingTrafficFromPeerHickwallAddr: getInComingTrafficFromPeerHickwallAddr,\n getPeerSyncFullHickwallAddr: getPeerSyncFullHickwallAddr,\n getPeerSyncPartialHickwallAddr: getPeerSyncPartialHickwallAddr,\n getShardRedisRole: getShardRedisRole,\n getShardKeeperState: getShardKeeperState,\n getShardCheckerHealthCheck: getShardCheckerHealthCheck,\n getShardAllMeta: getShardAllMeta\n };\n}\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/services/HealthCheckService.ts?"); +eval("angular\n .module('services')\n .service('HealthCheckService', HealthCheckService);\nHealthCheckService.$inject = ['$resource', '$q'];\nfunction HealthCheckService($resource, $q) {\n var IS_REDIS_HEALTH = \"is_redis_health\";\n var GET_REPL_DELAY = \"get_repl_delay\";\n var GET_SHARD_DELAY = \"get_shard_delay\";\n var GET_HICKWALL_ADDR = \"get_hickwall_addr\";\n var GET_HETERO_HICKWALL_ADDR = \"get_hetero_hickwall_addr\";\n var GET_CROSS_MASTER_DELAY = \"get_cross_master_delay\";\n var GET_CROSS_MASTER_HICKWALL_ADDR = \"get_cross_master_hickwall_addr\";\n var GET_PEER_OUTCOMING = \"get_peer_outcoming\";\n var GET_PEER_INCOMING = \"get_peer_incoming\";\n var GET_PEER_FULL_SYNC = \"get_peer_full_sync\";\n var GET_PEER_PARTIAL_SYNC = \"get_peer_partial_sync\";\n var GET_SHARD_REDIS_ROLE = \"get_shard_redis_role\";\n var GET_SHARD_KEEPER_STATE = \"get_shard_keeper_state\";\n var GET_SHARD_CHECKER_HEALTH_CHECK = \"get_shard_checker_health_check\";\n var GET_SHARD_ALL_META = \"get_shard_all_meta\";\n var RESET_ELECTION = \"reset_election\";\n var apis = (function initResourceParam() {\n var apis = {};\n apis[IS_REDIS_HEALTH] = {\n method: 'GET',\n url: '/console/redis/health/:redisIp/:redisPort'\n };\n apis[GET_REPL_DELAY] = {\n method: 'GET',\n url: '/console/redis/delay/:clusterType/:redisIp/:redisPort'\n };\n apis[GET_SHARD_DELAY] = {\n method: 'GET',\n url: '/console/shard/delay/:clusterId/:shardId/:shardDbId'\n };\n apis[GET_HICKWALL_ADDR] = {\n method: 'GET',\n url: '/console/redis/health/hickwall/:cluster/:shard/:redisIp/:redisPort/:delayType'\n };\n apis[GET_HETERO_HICKWALL_ADDR] = {\n method: 'GET',\n url: '/console/hetero/health/hickwall/:cluster/:srcShardId/:delayType'\n };\n apis[GET_CROSS_MASTER_DELAY] = {\n method: 'GET',\n url: '/console/cross-master/delay/:clusterType/:dc/:cluster/:shard'\n };\n apis[GET_CROSS_MASTER_HICKWALL_ADDR] = {\n method: 'GET',\n url: '/console/cross-master/health/hickwall/:cluster/:shard/:sourceDc/:destDc'\n };\n apis[GET_PEER_OUTCOMING] = {\n method: 'GET',\n url: '/console/redis/outcoming/traffic/to/peer/hickwall/:redisIp/:redisPort'\n };\n apis[GET_PEER_INCOMING] = {\n method: 'GET',\n url: '/console/redis/incoming/traffic/from/peer/hickwall/:redisIp/:redisPort'\n };\n apis[GET_PEER_FULL_SYNC] = {\n method: 'GET',\n url: '/console/redis/peer/sync/full/hickwall/:redisIp/:redisPort'\n };\n apis[GET_PEER_PARTIAL_SYNC] = {\n method: 'GET',\n url: '/console/redis/peer/sync/partial/hickwall/:redisIp/:redisPort'\n };\n apis[GET_SHARD_REDIS_ROLE] = {\n method: 'GET',\n url: '/api/redis/role/:dcId/:clusterId/:shardId',\n isArray: true\n };\n apis[GET_SHARD_KEEPER_STATE] = {\n method: 'GET',\n url: '/api/keeper/states/:dcId/:clusterId/:shardId',\n isArray: true\n };\n apis[GET_SHARD_CHECKER_HEALTH_CHECK] = {\n method: 'GET',\n url: '/api/checker/groups/:dcId/:clusterId/:shardId',\n isArray: true\n };\n apis[GET_SHARD_ALL_META] = {\n method: 'GET',\n url: '/api/meta/all/:dcId/:clusterId/:shardId'\n };\n return apis;\n })();\n var resource = $resource('', {}, apis);\n function request(q, method, params) {\n resource[method](params, function (result) {\n q.resolve(result);\n }, function (result) {\n q.reject(result);\n });\n return q.promise;\n }\n function isRedisHealth(ip, port) {\n return request($q.defer(), IS_REDIS_HEALTH, {\n redisIp: ip,\n redisPort: port\n });\n }\n function getReplDelay(ip, port, clusterType) {\n return request($q.defer(), GET_REPL_DELAY, {\n clusterType: clusterType,\n redisIp: ip,\n redisPort: port\n });\n }\n function getShardDelay(clusterId, shardId, shardDbId) {\n return request($q.defer(), GET_SHARD_DELAY, {\n clusterId: clusterId,\n shardId: shardId,\n shardDbId: shardDbId\n });\n }\n function getHickwallAddr(cluster, shard, redisIp, redisPort, delayType) {\n return request($q.defer(), GET_HICKWALL_ADDR, {\n cluster: cluster,\n shard: shard,\n redisIp: redisIp,\n redisPort: redisPort,\n delayType: delayType\n });\n }\n function getHeteroHickwallAddr(cluster, srcShardId, delayType) {\n return request($q.defer(), GET_HETERO_HICKWALL_ADDR, {\n cluster: cluster,\n srcShardId: srcShardId,\n delayType: delayType\n });\n }\n function getCrossMasterDelay(dc, cluster, shard, clusterType) {\n return request($q.defer(), GET_CROSS_MASTER_DELAY, {\n dc: dc, cluster: cluster, shard: shard, clusterType: clusterType\n });\n }\n function getCrossMasterHickwallAddr(cluster, shard, sourceDc, destDc) {\n return request($q.defer(), GET_CROSS_MASTER_HICKWALL_ADDR, {\n cluster: cluster, shard: shard, sourceDc: sourceDc, destDc: destDc\n });\n }\n function getOutComingTrafficToPeerHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_OUTCOMING, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getInComingTrafficFromPeerHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_INCOMING, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getPeerSyncFullHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_FULL_SYNC, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getPeerSyncPartialHickwallAddr(redisIp, redisPort) {\n return request($q.defer(), GET_PEER_PARTIAL_SYNC, {\n redisIp: redisIp,\n redisPort: redisPort\n });\n }\n function getShardRedisRole(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_REDIS_ROLE, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n function getShardKeeperState(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_KEEPER_STATE, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n function getShardCheckerHealthCheck(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_CHECKER_HEALTH_CHECK, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n function getShardAllMeta(dcId, clusterId, shardId) {\n return request($q.defer(), GET_SHARD_ALL_META, {\n dcId: dcId,\n clusterId: clusterId,\n shardId: shardId\n });\n }\n return {\n isRedisHealth: isRedisHealth,\n getReplDelay: getReplDelay,\n getShardDelay: getShardDelay,\n getHickwallAddr: getHickwallAddr,\n getHeteroHickwallAddr: getHeteroHickwallAddr,\n getCrossMasterDelay: getCrossMasterDelay,\n getCrossMasterHickwallAddr: getCrossMasterHickwallAddr,\n getOutComingTrafficToPeerHickwallAddr: getOutComingTrafficToPeerHickwallAddr,\n getInComingTrafficFromPeerHickwallAddr: getInComingTrafficFromPeerHickwallAddr,\n getPeerSyncFullHickwallAddr: getPeerSyncFullHickwallAddr,\n getPeerSyncPartialHickwallAddr: getPeerSyncPartialHickwallAddr,\n getShardRedisRole: getShardRedisRole,\n getShardKeeperState: getShardKeeperState,\n getShardCheckerHealthCheck: getShardCheckerHealthCheck,\n getShardAllMeta: getShardAllMeta\n };\n}\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/services/HealthCheckService.ts?"); /***/ }), @@ -9463,7 +9463,7 @@ eval("angular\n .module('services')\n .service('HealthCheckService', Healt \****************************************************/ /***/ (() => { -eval("angular\n .module('services')\n .service('KeeperContainerService', ['$resource', '$q', function ($resource, $q) {\n var resource = $resource('', {}, {\n find_availablekeepers_by_dc: {\n method: 'POST',\n url: '/console/dcs/:dcName/availablekeepers',\n isArray: true\n },\n find_active_kcs_by_dc_and_cluster: {\n method: 'GET',\n url: '/console/dcs/:dcName/cluster/:clusterName/activekeepercontainers',\n isArray: true\n },\n find_keepercontainer_by_id: {\n method: 'GET',\n url: '/console/keepercontainer/:id',\n },\n find_available_keepers_by_dc_az_and_org: {\n method: 'GET',\n url: '/console/keepercontainers/dc/:dcName/az/:azName/org/:orgName',\n isArray: true\n },\n get_all_infos: {\n method: 'GET',\n url: '/console/keepercontainer/infos/all',\n isArray: true\n },\n get_all_diskTypes: {\n method: 'GET',\n url: '/console/keepercontainer/diskType',\n isArray: true\n },\n get_all_organizations: {\n method: 'GET',\n url: '/console/organizations',\n isArray: true\n },\n add_keepercontainer: {\n method: 'POST',\n url: '/console/keepercontainer'\n },\n update_keepercontainer: {\n method: 'PUT',\n url: '/console/keepercontainer'\n },\n get_all_overload_keepercontainer: {\n method: 'GET',\n url: '/console/keepercontainers/overload/all',\n isArray: true\n },\n get_all_overload_lasted_used_info: {\n method: 'GET',\n url: '/console/keepercontainer/overload/info/lasted',\n isArray: true\n },\n get_overload_keepercontainer_migration_process: {\n method: 'GET',\n url: '/console/keepercontainer/overload/migration/process',\n isArray: true\n },\n get_all_available_zone_info_models_by_dc: {\n method: 'GET',\n url: '/console/az/dcs/tbl/:dcId',\n isArray: true\n },\n begin_to_migrate_overload_keepercontainer: {\n method: 'POST',\n url: '/console/keepercontainer/overload/migration/begin'\n },\n migrate_keeper_task_terminate: {\n method: 'POST',\n url: '/console/keepercontainer/overload/migration/terminate'\n },\n stop_to_migrate_overload_keepercontainer: {\n method: 'POST',\n url: '/console/keepercontainer/overload/migration/stop'\n }\n });\n function findActiveKeeperContainersByDc(dcName) {\n var d = $q.defer();\n resource.find_activekeepercontainers_by_dc({\n dcName: dcName\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findAvailableKeepersByDc(dcName, shard) {\n var d = $q.defer();\n resource.find_availablekeepers_by_dc({\n dcName: dcName\n }, shard, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findKeepercontainerById(id) {\n var d = $q.defer();\n resource.find_keepercontainer_by_id({\n id: id\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findAvailableKeepersByDcAzAndOrg(dcName, azName, orgName) {\n var d = $q.defer();\n resource.find_available_keepers_by_dc_az_and_org({\n dcName: dcName,\n azName: azName,\n orgName: orgName\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllAvailableZoneInfoModelsByDc(dcId) {\n var d = $q.defer();\n resource.get_all_available_zone_info_models_by_dc({\n dcId: dcId\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findAvailableKeepersByDcAndCluster(dcName, clusterName) {\n var d = $q.defer();\n resource.find_active_kcs_by_dc_and_cluster({\n dcName: dcName,\n clusterName: clusterName\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllInfos() {\n var d = $q.defer();\n resource.get_all_infos({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllOrganizations() {\n var d = $q.defer();\n resource.get_all_organizations({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllDiskTypes() {\n var d = $q.defer();\n resource.get_all_diskTypes({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function addKeepercontainer(addr, dcName, orgName, azName, active, diskType) {\n var d = $q.defer();\n resource.add_keepercontainer({}, {\n addr: addr,\n dcName: dcName,\n orgName: orgName,\n azName: azName,\n active: active,\n diskType: diskType\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function updateKeepercontainer(addr, dcName, orgName, azName, active, diskType) {\n var d = $q.defer();\n resource.update_keepercontainer({}, {\n addr: addr,\n dcName: dcName,\n orgName: orgName,\n azName: azName,\n active: active,\n diskType: diskType\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllOverloadKeepercontainer() {\n var d = $q.defer();\n resource.get_all_overload_keepercontainer({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllKeepercontainerUsedInfo() {\n var d = $q.defer();\n resource.get_all_overload_lasted_used_info({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getOverloadKeeperContainerMigrationProcess() {\n var d = $q.defer();\n resource.get_overload_keepercontainer_migration_process({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function beginToMigrateOverloadKeeperContainers() {\n var d = $q.defer();\n resource.begin_to_migrate_overload_keepercontainer(Array.from(arguments), function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function migrateKeeperTaskTerminate() {\n var d = $q.defer();\n resource.migrate_keeper_task_terminate({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n return {\n findAvailableKeepersByDc: findAvailableKeepersByDc,\n findAvailableKeepersByDcAndCluster: findAvailableKeepersByDcAndCluster,\n findKeepercontainerById: findKeepercontainerById,\n getAllAvailableZoneInfoModelsByDc: getAllAvailableZoneInfoModelsByDc,\n findAvailableKeepersByDcAzAndOrg: findAvailableKeepersByDcAzAndOrg,\n getAllInfos: getAllInfos,\n getAllOrganizations: getAllOrganizations,\n getAllDiskTypes: getAllDiskTypes,\n addKeepercontainer: addKeepercontainer,\n updateKeepercontainer: updateKeepercontainer,\n getAllOverloadKeepercontainer: getAllOverloadKeepercontainer,\n getAllKeepercontainerUsedInfo: getAllKeepercontainerUsedInfo,\n getOverloadKeeperContainerMigrationProcess: getOverloadKeeperContainerMigrationProcess,\n beginToMigrateOverloadKeeperContainers: beginToMigrateOverloadKeeperContainers,\n migrateKeeperTaskTerminate: migrateKeeperTaskTerminate,\n };\n }]);\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/services/KeeperContainerService.ts?"); +eval("angular\n .module('services')\n .service('KeeperContainerService', ['$resource', '$q', function ($resource, $q) {\n var resource = $resource('', {}, {\n find_availablekeepers_by_dc: {\n method: 'POST',\n url: '/console/dcs/:dcName/availablekeepers',\n isArray: true\n },\n find_active_kcs_by_dc_and_cluster: {\n method: 'GET',\n url: '/console/dcs/:dcName/cluster/:clusterName/activekeepercontainers',\n isArray: true\n },\n find_keepercontainer_by_id: {\n method: 'GET',\n url: '/console/keepercontainer/:id',\n },\n find_available_keepers_by_dc_az_and_org: {\n method: 'GET',\n url: '/console/keepercontainers/dc/:dcName/az/:azName/org/:orgName',\n isArray: true\n },\n get_all_infos: {\n method: 'GET',\n url: '/console/keepercontainer/infos/all',\n isArray: true\n },\n get_all_diskTypes: {\n method: 'GET',\n url: '/console/keepercontainer/diskType',\n isArray: true\n },\n get_all_organizations: {\n method: 'GET',\n url: '/console/organizations',\n isArray: true\n },\n add_keepercontainer: {\n method: 'POST',\n url: '/console/keepercontainer'\n },\n update_keepercontainer: {\n method: 'PUT',\n url: '/console/keepercontainer'\n },\n get_all_overload_keepercontainer: {\n method: 'GET',\n url: '/console/keepercontainers/overload/all',\n isArray: true\n },\n get_all_overload_lasted_used_info: {\n method: 'GET',\n url: '/console/keepercontainer/overload/info/lasted',\n isArray: true\n },\n get_overload_keepercontainer_migration_process: {\n method: 'GET',\n url: '/console/keepercontainer/overload/migration/process',\n isArray: true\n },\n get_all_available_zone_info_models_by_dc: {\n method: 'GET',\n url: '/console/az/dcs/tbl/:dcId',\n isArray: true\n },\n begin_to_migrate_overload_keepercontainer: {\n method: 'POST',\n url: '/console/keepercontainer/overload/migration/begin'\n },\n migrate_keeper_task_terminate: {\n method: 'POST',\n url: '/console/keepercontainer/overload/migration/terminate'\n },\n stop_to_migrate_overload_keepercontainer: {\n method: 'POST',\n url: '/console/keepercontainer/overload/migration/stop'\n },\n reset_election: {\n method: 'POST',\n url: '/api/keepers/election/reset/:ip/:port/:shardId'\n }\n });\n function findActiveKeeperContainersByDc(dcName) {\n var d = $q.defer();\n resource.find_activekeepercontainers_by_dc({\n dcName: dcName\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findAvailableKeepersByDc(dcName, shard) {\n var d = $q.defer();\n resource.find_availablekeepers_by_dc({\n dcName: dcName\n }, shard, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findKeepercontainerById(id) {\n var d = $q.defer();\n resource.find_keepercontainer_by_id({\n id: id\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findAvailableKeepersByDcAzAndOrg(dcName, azName, orgName) {\n var d = $q.defer();\n resource.find_available_keepers_by_dc_az_and_org({\n dcName: dcName,\n azName: azName,\n orgName: orgName\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllAvailableZoneInfoModelsByDc(dcId) {\n var d = $q.defer();\n resource.get_all_available_zone_info_models_by_dc({\n dcId: dcId\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function findAvailableKeepersByDcAndCluster(dcName, clusterName) {\n var d = $q.defer();\n resource.find_active_kcs_by_dc_and_cluster({\n dcName: dcName,\n clusterName: clusterName\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllInfos() {\n var d = $q.defer();\n resource.get_all_infos({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllOrganizations() {\n var d = $q.defer();\n resource.get_all_organizations({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllDiskTypes() {\n var d = $q.defer();\n resource.get_all_diskTypes({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function addKeepercontainer(addr, dcName, orgName, azName, active, diskType) {\n var d = $q.defer();\n resource.add_keepercontainer({}, {\n addr: addr,\n dcName: dcName,\n orgName: orgName,\n azName: azName,\n active: active,\n diskType: diskType\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function updateKeepercontainer(addr, dcName, orgName, azName, active, diskType) {\n var d = $q.defer();\n resource.update_keepercontainer({}, {\n addr: addr,\n dcName: dcName,\n orgName: orgName,\n azName: azName,\n active: active,\n diskType: diskType\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllOverloadKeepercontainer() {\n var d = $q.defer();\n resource.get_all_overload_keepercontainer({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getAllKeepercontainerUsedInfo() {\n var d = $q.defer();\n resource.get_all_overload_lasted_used_info({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function getOverloadKeeperContainerMigrationProcess() {\n var d = $q.defer();\n resource.get_overload_keepercontainer_migration_process({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function beginToMigrateOverloadKeeperContainers() {\n var d = $q.defer();\n resource.begin_to_migrate_overload_keepercontainer(Array.from(arguments), function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function migrateKeeperTaskTerminate() {\n var d = $q.defer();\n resource.migrate_keeper_task_terminate({}, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n function resetElection(ip, port, shardId) {\n var d = $q.defer();\n resource.reset_election({\n ip: ip,\n port: port,\n shardId: shardId\n }, function (result) {\n d.resolve(result);\n }, function (result) {\n d.reject(result);\n });\n return d.promise;\n }\n return {\n findAvailableKeepersByDc: findAvailableKeepersByDc,\n findAvailableKeepersByDcAndCluster: findAvailableKeepersByDcAndCluster,\n findKeepercontainerById: findKeepercontainerById,\n getAllAvailableZoneInfoModelsByDc: getAllAvailableZoneInfoModelsByDc,\n findAvailableKeepersByDcAzAndOrg: findAvailableKeepersByDcAzAndOrg,\n getAllInfos: getAllInfos,\n getAllOrganizations: getAllOrganizations,\n getAllDiskTypes: getAllDiskTypes,\n addKeepercontainer: addKeepercontainer,\n updateKeepercontainer: updateKeepercontainer,\n getAllOverloadKeepercontainer: getAllOverloadKeepercontainer,\n getAllKeepercontainerUsedInfo: getAllKeepercontainerUsedInfo,\n getOverloadKeeperContainerMigrationProcess: getOverloadKeeperContainerMigrationProcess,\n beginToMigrateOverloadKeeperContainers: beginToMigrateOverloadKeeperContainers,\n migrateKeeperTaskTerminate: migrateKeeperTaskTerminate,\n resetElection: resetElection\n };\n }]);\n\n\n//# sourceURL=webpack://XPipe-Console/./scripts/services/KeeperContainerService.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 61c17587a..84ae0133d 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 @@ -7,10 +7,10 @@ angular $mdThemingProvider.theme('orange').backgroundPalette('orange'); }); -FullLinkHealthCheckCtl.$inject = ['$rootScope', '$scope', '$window', '$stateParams', 'HealthCheckService', +FullLinkHealthCheckCtl.$inject = ['$rootScope', '$scope', '$window', '$stateParams', 'HealthCheckService', 'KeeperContainerService', 'toastr', 'NgTableParams', 'AppUtil', '$interval']; -function FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, HealthCheckService, +function FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, HealthCheckService, KeeperContainerService, toastr, NgTableParams, $interval) { $scope.masterRoles = []; $scope.slaveRoles = []; @@ -25,6 +25,11 @@ function FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, Healt $scope.doShowActions = doShowActions; $scope.getShardAllMeta = getShardAllMeta; $scope.getShardKeeperState = getShardKeeperState; + $scope.resetElection = resetElection; + $scope.ableResetElection = false; + $scope.getAbleResetElection = getAbleResetElection; + $scope.resetElectionErr = null; + $scope.getResetElectionErr = getResetElectionErr; redisRoleHealthCheck(); shardCheckerGroupHealthCheck(); @@ -73,9 +78,33 @@ function FullLinkHealthCheckCtl($rootScope, $scope, $window, $stateParams, Healt }) } + function resetElection(ip, port) { + $scope.ableResetElection = true; + KeeperContainerService.resetElection(ip, port, $stateParams.shardId).then(function (response) { + $scope.ableResetElection = false; + if (response.state != 0) { + $scope.resetElectionErr = response.message; + $('#resetElectionErr').modal('show'); + } else { + getShardKeeperState(); + } + }).catch(function (error){ + $scope.resetElectionErr = error.status + " " + error.statusText; + $scope.ableResetElection = false; + $('#resetElectionErr').modal('show'); + }) + } + + function getResetElectionErr() { + return $scope.resetElectionErr; + } + function doShowActions() { $scope.showActions = !$scope.showActions; } + function getAbleResetElection() { + return $scope.ableResetElection; + } } \ No newline at end of file diff --git a/redis/redis-console/src/main/resources/static/scripts/services/HealthCheckService.ts b/redis/redis-console/src/main/resources/static/scripts/services/HealthCheckService.ts index 3594f7a8e..1555f87d5 100644 --- a/redis/redis-console/src/main/resources/static/scripts/services/HealthCheckService.ts +++ b/redis/redis-console/src/main/resources/static/scripts/services/HealthCheckService.ts @@ -20,6 +20,7 @@ function HealthCheckService($resource, $q) { const GET_SHARD_KEEPER_STATE = "get_shard_keeper_state"; const GET_SHARD_CHECKER_HEALTH_CHECK = "get_shard_checker_health_check"; const GET_SHARD_ALL_META = "get_shard_all_meta"; + const RESET_ELECTION = "reset_election"; var apis = (function initResourceParam() { var apis = {}; @@ -213,6 +214,7 @@ function HealthCheckService($resource, $q) { }); } + return { isRedisHealth : isRedisHealth, getReplDelay : getReplDelay, diff --git a/redis/redis-console/src/main/resources/static/scripts/services/KeeperContainerService.ts b/redis/redis-console/src/main/resources/static/scripts/services/KeeperContainerService.ts index b6ab8ea14..13ae73947 100644 --- a/redis/redis-console/src/main/resources/static/scripts/services/KeeperContainerService.ts +++ b/redis/redis-console/src/main/resources/static/scripts/services/KeeperContainerService.ts @@ -76,6 +76,10 @@ angular stop_to_migrate_overload_keepercontainer:{ method:'POST', url:'/console/keepercontainer/overload/migration/stop' + }, + reset_election:{ + method:'POST', + url:'/api/keepers/election/reset/:ip/:port/:shardId' } }); @@ -285,6 +289,21 @@ angular return d.promise; } + function resetElection(ip, port, shardId) { + var d = $q.defer(); + resource.reset_election({ + ip:ip, + port:port, + shardId:shardId + }, + function (result) { + d.resolve(result); + }, function (result) { + d.reject(result); + }); + return d.promise; + } + return { findAvailableKeepersByDc : findAvailableKeepersByDc, findAvailableKeepersByDcAndCluster : findAvailableKeepersByDcAndCluster, @@ -301,5 +320,6 @@ angular getOverloadKeeperContainerMigrationProcess : getOverloadKeeperContainerMigrationProcess, beginToMigrateOverloadKeeperContainers : beginToMigrateOverloadKeeperContainers, migrateKeeperTaskTerminate : migrateKeeperTaskTerminate, + resetElection: resetElection } }]); diff --git a/redis/redis-console/src/main/resources/static/views/index/cluster_dc_shards.html b/redis/redis-console/src/main/resources/static/views/index/cluster_dc_shards.html index 45d6a0960..dfb5386c5 100644 --- a/redis/redis-console/src/main/resources/static/views/index/cluster_dc_shards.html +++ b/redis/redis-console/src/main/resources/static/views/index/cluster_dc_shards.html @@ -28,7 +28,7 @@

{{shard.shardTbl.shardName}}(cluster_{{shard.shardTbl.clusterId}}.shard_{{shard.shardTbl.id}})
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 9fa21087b..06cab2ad2 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 @@ -104,6 +104,9 @@ {{keeper.masterReplOffset}}
+ + reset Election +
@@ -138,6 +141,12 @@
+ + + +