(错误)在redis-cli上的ERR未知命令'XTRIM'

时间:2019-03-14 11:26:31

标签: redis redis-cli redisclient

在redis-cli上运行时出现错误:"(error) ERR unknown command 'XTRIM'"

127.0.0.1:6379> info
# Server
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7897e7d0e13773f
redis_mode:standalone
os:Linux 3.10.0-957.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.5
process_id:36305
run_id:5759acadb741325a8022dad3c136dd9cc26d66d8
tcp_port:6379
uptime_in_seconds:2062
uptime_in_days:0
hz:10
lru_clock:9078505
executable:/usr/bin/redis-server
config_file:/etc/redis.conf

上面是redis服务器的信息。

无以“ X”'XTRIM','XADD','XGROUP'开头的命令不起作用。

[root@localhost lib]# redis-cli
127.0.0.1:6379> XTRIM TXNLOG MAXLEN 0
(error) ERR unknown command 'XTRIM'
127.0.0.1:6379> XGROUP CREATE TXNLOG test 0 MKSTREAM
(error) ERR unknown command 'XGROUP'

1 个答案:

答案 0 :(得分:2)

您应该升级到Redis 5.x

要首先执行此操作,请转到/tmp目录:

$ cd /tmp

然后按来源下载和make重做:

$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make

然后运行redis-server:

$ src/redis-server