ngbdf / redis-manager

Redis 一站式管理平台,支持集群的监控、安装、管理、告警以及基本的数据操作
Apache License 2.0
2.94k stars 714 forks source link

Cluster 模式Scan不到数据 #134

Open ReasonDuan opened 3 years ago

ReasonDuan commented 3 years ago

Cluster模式,在查询页面进行Scan时无法获取到数据。

        List<RedisNode> redisMasterNodeList = getRedisMasterNodeList(cluster);
        int masterSize = redisMasterNodeList.size();
        int count = masterSize < 10 ? 100 / masterSize : 10;
        autoCommandParam.setCount(count);
        Set<String> result = new LinkedHashSet<>();
        redisMasterNodeList.forEach(masterNode -> {
            RedisClient redisClient = null;
            try {
                redisClient = RedisClientFactory.buildRedisClient(masterNode, cluster.getRedisPassword());
                Set<String> scanResult = redisClient.scan(autoCommandParam);
                result.addAll(scanResult);
            } catch (Exception e) {
                logger.error("Scan redis failed, node = " + masterNode.getHost() + ":" + masterNode.getPort(), e);
            } finally {
                close(redisClient);
            }
        });