zoukankan      html  css  js  c++  java
  • redis-trib in golang

    缘由

    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
    
  • 相关阅读:
    php使用iconv进行从utf8转为gb2312字符编码出错解决方案
    PHP 的 cURL库快速入门文档
    转载 DISCUZ!X1程序目录、文件列表及模板文件结构说明,帮助大家二级开发
    下拉菜单部分选项不允许选择
    Htaccess文件用法集锦
    MYSQL server has gone away解决办法
    Discuz X 模板中获取用户头像
    CSS Hack
    VS轻松保存重复多用的代码片段
    三菱FX PLC编程口通讯协议详解
  • 原文地址:https://www.cnblogs.com/hiyang/p/13662432.html
Copyright © 2011-2022 走看看