redis集群压测报错Error from server: MOVED

发布时间 2023-12-02 01:59:33作者: tom_log

## redis集群压测报错Error from server: MOVED

## 故障描述

redis7集群压测报错

```sh

Summary:

throughput summary: 31250.00 requests per second

latency summary (msec):

avg min p50 p95 p99 max

7.907 1.664 7.007 12.999 13.775 14.127

Error from server: MOVED 13782 192.168.17.104:7000: -nan)

```

## 排查过程

- 节点网络是否畅通

- 检查防火墙&selinux

- 服务是否正常

- 节点槽位分配是否到位

- 手动测试是否可以路由到槽

 

## 结论

以上检查均正常,最后--help发现 redis-benchmark 集群模式压测需要加参数 --cluster 路由到槽

 

```sh

[root@redis102 redis]# redis-benchmark --help

Usage: redis-benchmark [OPTIONS] [COMMAND ARGS...]

 

Options:

-h <hostname> Server hostname (default 127.0.0.1)

-p <port> Server port (default 6379)

-s <socket> Server socket (overrides host and port)

-a <password> Password for Redis Auth

--user <username> Used to send ACL style 'AUTH username pass'. Needs -a.

-u <uri> Server URI.

-c <clients> Number of parallel connections (default 50)

-n <requests> Total number of requests (default 100000)

-d <size> Data size of SET/GET value in bytes (default 3)

--dbnum <db> SELECT the specified db number (default 0)

-3 Start session in RESP3 protocol mode.

--threads <num> Enable multi-thread mode.

--cluster Enable cluster mode.

If the command is supplied on the command line in cluster

mode, the key must contain "{tag}". Otherwise, the

command will not be sent to the right cluster node.

#启用集群模式。

如果在集群中的命令行上提供该命令

模式下,键必须包含“{tag}”。 否则,

命令将不会发送到正确的集群节点。

```