Redis 5.0 中引入的集群管理新特性
Redis 5.0 最近 (17/10/2018
) 刚刚发布, 其中引入了一些非常令人期待的特性, 其中就有集群管理的新命令。 而在之前, 是由 Ruby 写的 redis-trib.rb
提供了集群管理的相关命令.
目录
Redis 5 中的新特性
下面是 Redis 5.0 发行日志中提及的更新和改进:
- 新的
Stream
数据类型, https://redis.io/topics/streams-intro - 新的 Redis 模块 APIs:
Timers
,Cluster
和Dictionary
- RBD 现已支持存储
LFU
和LRU
信息 redis-cli
中的集群管理功能现从Ruby
(redis-trib.rb
) 转换到 C 实现. 通过redis-cli --cluster help
查看更多信息- 新的
有序集合
(sorted set
) 命令:ZPOPMIN/MAX
和阻塞变量
(blocking variant
) 主动碎片整理
(Active defragmentation
) 更新到第 2 版- 增强
基数
(HyperLogLog
) 实现. - 更好的内存报告能力.
- 许多有子命令的命令现在有了
help
子命令. - 在客户端频繁连接和断开连接时有更好的性能
- 许多错误修复和其他一些改进
Jemalloc
更新到 5.1 版- 新引入
CLIENT UNBLOCK
和 `CLIENT ID - 加入了
LOLWUT
命令. 见 http://antirez.com/news/123 - 在不用 API 向后兼容的地方弃用了
slave
一词 - 网络层不同程度的优化
- Lua 解释器改进:
- 更好地将 lua 脚本传递给
replicas/AOL
- Lua 脚本现在也可以在
replicas
中超时, 进入-BUSY
状态
- 更好地将 lua 脚本传递给
- 动态的
HZ
以平衡闲置 CPU 使用率, 提高响应能力 - Redis 核心现已重构并有多处改进
- 许多其他的改进优化…
Redis 中的集群管理
运行 redis-cli --cluster help
可以查看集群管理相关的子命令:
$ redis-cli --cluster help
Cluster Manager Commands:
create host1:port1 ... hostN:portN
--cluster-replicas
check host:port
info host:port
fix host:port
reshard host:port
--cluster-from
--cluster-to
--cluster-slots
--cluster-yes
--cluster-timeout
--cluster-pipeline
rebalance host:port
--cluster-weight
--cluster-use-empty-masters
--cluster-timeout
--cluster-simulate
--cluster-pipeline
--cluster-threshold
add-node new_host:new_port existing_host:existing_port
--cluster-slave
--cluster-master-id
del-node host:port node_id
call host:port command arg arg .. arg
set-timeout host:port milliseconds
import host:port
--cluster-from
--cluster-copy
--cluster-replace
help
For check, fix, reshard, del-node, set-timeout you can specify the host and port of any working node in the cluster.


