- 1. Overview
- 1. 概述
- 2. Configuration
- 2. 配置方法
- 3. Operations execution
- 3. 程序接口调用方式
- 4. Data serialization
- 4. 数据序列化
- 5. Data partitioning(sharding)
- 5. 单个集合数据分片(Sharding)
- 5.1. Common operations over objects
- 6. Distributed objects
- 6. 分布式对象
- 7. Distributed collections
- 7. 分布式集合
- 8. Distributed locks and synchronizers
- 8. 分布式锁和同步器
- 9. Distributed services
- 9. 分布式服务
- 10. Additional features
- 10. 额外功能
- 11. Redis commands mapping
- 11. Redis 命令和 Redisson 对象匹配列表
- 12. Standalone node
- 12. 独立节点模式
- 13. Tools
- 13. 工具
- 14. Integration with frameworks
- 14. 第三方框架整合
- 15. Dependency list
- 15. 项目依赖列表
- 16. FAQ
- 16. Observability
13. Tools
13.1. Cluster management tool
Cluster management tool allows easily manage by Redis cluster nodes like redis-trib.rb
script does.
13.1.1 Cluster management tool. Create Redis cluster
Below is an example how to create cluster with 3 masters and 3 slaves.
ClusterNodes clusterNodes = ClusterNodes.create()
.master("127.0.0.1:7000").withSlaves("127.0.0.1:7001", "127.0.0.1:7002")
.master("127.0.0.1:7003").withSlaves("127.0.0.1:7004")
.master("127.0.0.1:7005");
ClusterManagementTool.createCluster(clusterNodes);
127.0.0.1:7000
has slaves 127.0.0.1:7001
, 127.0.0.1:7002
127.0.0.1:7003
has slaves 127.0.0.1:7004
127.0.0.1:7005
doesn't have slaves.
13.1.2 Cluster management tool. Remove Redis node
Below is an example how to remove node from cluster.
ClusterManagementTool.removeNode("127.0.0.1:7000", "127.0.0.1:7002");
// or
redisson.getClusterNodesGroup().removeNode("127.0.0.1:7002");
Removes 127.0.0.1:7002
from cluster where 127.0.0.1:7000
participate in
13.1.3 Cluster management tool. Move slots between Redis nodes
Below is an example how to move slots between cluster master nodes.
ClusterManagementTool.moveSlots("127.0.0.1:7000", "127.0.0.1:7002", 23, 419, 4712, 8490);
// or
redisson.getClusterNodesGroup().moveSlots("127.0.0.1:7000", "127.0.0.1:7002", 23, 419, 4712, 8490);
Moves slots 23
, 419
, 4712
, 8490
from 127.0.0.1:7002
to 127.0.0.1:7000
node
Below is an example how to move slots range between cluster master nodes.
ClusterManagementTool.moveSlotsRange("127.0.0.1:7000", "127.0.0.1:7002", 51, 9811);
// or
redisson.getClusterNodesGroup().moveSlotsRange("127.0.0.1:7000", "127.0.0.1:7002", 51, 9811);
Moves slots range [51, 9811] from 127.0.0.1:7002
to 127.0.0.1:7000
node
13.1.4 Cluster management tool. Add slave Redis node
Below is an example how to add slave node to cluster.
ClusterManagementTool.addSlaveNode("127.0.0.1:7000", "127.0.0.1:7003");
// or
redisson.getClusterNodesGroup().addSlaveNode("127.0.0.1:7003");
Adds slave node 127.0.0.1:7003
to cluster where 127.0.0.1:7000
participate in
13.1.5 Cluster management tool. Add master Redis node
Below is an example how to add master node to cluster.
ClusterManagementTool.addMasterNode("127.0.0.1:7000", "127.0.0.1:7004");
// or
redisson.getClusterNodesGroup().addMasterNode("127.0.0.1:7004");
Adds master node 127.0.0.1:7004
to cluster where 127.0.0.1:7000
participate in
This feature available only in Redisson PRO edition.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论