码迷,mamicode.com
首页 > 其他好文 > 详细

redis-trib in golang

时间:2020-09-18 00:07:49      阅读:30      评论:0      收藏:0      [点我收藏+]

标签:show   configure   help   password   global   lang   command   clu   set   

缘由

redis 5 之前,可以使用 redis-trib.rb 创建 redis cluster,但是依赖ruby,所以实际并不好用。
或者使用 redis-cli 创建 redis cluster,但是步骤较多,没法一次性完成。
故在 github 上找了一个使用 go 写的 redis-trib,就不在有依赖。稍作修改,添加了密码选项,如果创建 redis cluster 时,集群已经加密的话也可以用。

项目在这里,也可以在这里下载

Usage

NAME:
   redis-trib - Redis Cluster command line utility.

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

USAGE:
   redis-trib [global options] command [command options] [arguments...]

VERSION:
   v0.2.1
commit: 89485bd15e7fd42d365a66b4cc87339461e718c7
giturl: https://github.com/PoplarYang/redis-trib

AUTHOR:
   PoplarYang <echohiyang@foxmail.com>

COMMANDS:
     add-node, add  add a new redis node to existed cluster.
     call           run command in redis cluster.
     check          check the redis cluster.
     create         create a new redis cluster.
     del-node, del  del a redis node from existed cluster.
     fix            fix the redis cluster.
     import         import operation for redis cluster.
     info           display the info of redis cluster.
     rebalance      rebalance the redis cluster.
     reshard        reshard the redis cluster.
     set-timeout    set timeout configure for redis cluster.
     help, h        Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --debug             enable debug output for logging
   --verbose           verbose global flag for output.
   --log value         set the log file path where internal debug information is written
   --log-format value  set the format used by logs (‘text‘ (default), or ‘json‘) (default: "text")
   --help, -h          show help
   --version, -v       print the version

创建 redis cluster

查看帮助

[root@node1 godev]# ./redis-trib create --help
NAME:
   redis-trib create - create a new redis cluster.

USAGE:
   redis-trib create [command options] <host1:port1 ... hostN:portN>

DESCRIPTION:
   The create command create a redis cluster.

OPTIONS:
   --replicas value, -r value  Slave number for every master created, the default value is none.

    $ redis-trib create <--replicas 1> <host1:port1 ... hostN:portN> (default: 0)
   --password value, -a value  password, the default value is ""
    $ redis-trib create <--replicas 1> <--password ""> <host1:port1 ... hostN:portN> (default: 0)

创建 cluster

./redis-trib create --replicas 1 --password abc1234 10.10.10.51:6901 10.10.10.52:6901 10.10.10.53:6901 10.10.10.51:7901 10.10.10.52:7901 10.10.10.53:7901

redis-trib in golang

标签:show   configure   help   password   global   lang   command   clu   set   

原文地址:https://www.cnblogs.com/hiyang/p/13662432.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!