linux redis-trib.rb,linux - redis-trib.rb 命令详解

参考网站

http://www.cnblogs.com/ivictor/p/9768010.html

简介

redis-trib.rb是官方提供的Redis Cluster的管理工具,无需额外下载,默认位于源码包的src目录下,但因该工具是用ruby开发的,所以需要准备相关的依赖环境

准备redis-trib.rb的运行环境

wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz

tar xvf ruby-2.5.1.tar.gz

cd ruby-2.5.1/

./configure -prefix=/usr/local/ruby

make

make install

cd /usr/local/ruby/

cp bin/ruby /usr/local/bin

cp bin/gem /usr/local/bin

安装rubygem redis依赖

wget http://rubygems.org/downloads/redis-3.3.0.gem

gem install -l redis-3.3.0.gem

redis-trib.rb支持的操作

9b579c66ca54e7a63f1fd5b391df202f.gif

# redis-trib.rb help

Usage: redis-trib

create host1:port1 ... hostN:portN

--replicas

check host:port

info host:port

fix host:port

--timeout

reshard host:port

--from

--to

--slots

--yes

--timeout

--pipeline

rebalance host:port

--weight

--auto-weights

--use-empty-masters

--timeout

--simulate

--pipeline

--threshold

add-node new_host:new_port existing_host:existing_port

--slave

--master-id

del-node host:port node_id

set-timeout host:port milliseconds

call host:port command arg arg .. arg

import host:port

--from

--copy

--replace

help (show this help)

For check, fix, reshard, del-node, set-timeout you can specify the host and port of any working node in the cluster.

63b2362ebe700fc8a7b254e7a9598b15.gif

支持的操作如下:

1. create:创建集群

2. check:检查集群

3. info:查看集群信息

4. fix:修复集群

5. reshard:在线迁移slot

6. rebalance:平衡集群节点slot数量

7. add-node:添加新节点

8. del-node:删除节点

9. set-timeout:设置节点的超时时间

10. call:在集群所有节点上执行命令

11. import:将外部redis数据导入集群

你可能感兴趣的:(linux,redis-trib.rb)