redis-benchmark 报错 (error) ERR unknown command 'redis-benchmark' 无法性能测试

遇到这个问题,我想大家可能是因为看手册的时候没有认真的看。反正我是没有认真看。


手册上给的:

redis 性能测试的基本命令如下:

redis-benchmark [option] [option value]

这个不明显,看个例子:

实例

以下实例同时执行 10000 个请求来检测性能:

$ redis-benchmark -n 10000  -q

PING_INLINE: 141043.72 requests per second
PING_BULK: 142857.14 requests per second
SET: 141442.72 requests per second
GET: 145348.83 requests per second
INCR: 137362.64 requests per second
LPUSH: 145348.83 requests per second
LPOP: 146198.83 requests per second
SADD: 146198.83 requests per second
SPOP: 149253.73 requests per second
LPUSH (needed to benchmark LRANGE): 148588.42 requests per second
LRANGE_100 (first 100 elements): 58411.21 requests per second
LRANGE_300 (first 300 elements): 21195.42 requests per second
LRANGE_500 (first 450 elements): 14539.11 requests per second
LRANGE_600 (first 600 elements): 10504.20 requests per second
MSET (10 keys): 93283.58 requests per second

看红色字体不知道你意识到了没。如果没有那请继续往下看。

再找个示例看下:

Redis 哈希(Hash)

Redis hash 是一个string类型的field和value的映射表,hash特别适合用于存储对象。

Redis 中每个 hash 可以存储 232 - 1 键值对(40多亿)。

实例

127.0.0.1:6379>  HMSET runoobkey name "redis tutorial" description "redis basic commands for caching" likes 20 visitors 23000
OK
127.0.0.1:6379>  HGETALL runoobkey
1) "name"
2) "redis tutorial"
3) "description"
4) "redis basic commands for caching"
5) "likes"
6) "20"
7) "visitors"
8) "23000"

这个改意识到了吧。

原谅我卖关子了。其实就是 。redis-benchmark这个命令是不是redis-cli shell的命令。需要再常规的命令下运行。即退出shell执行该命令。

猜你喜欢

转载自blog.csdn.net/qq_33182756/article/details/80638203