• 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
    
  • 相关阅读:
    PB调用.NET类库详解
    一个游标的性能问题
    WCF实例与并发的一些测试
    PB调用.NET代码的两个入口函数
    SQL数据库表防JS木马注入
    Atitit 收入理论大总结 4位一体 4象限理论 财政收入理论 6位一体
    Atitit 融资 之道 圈钱之道 attilax总结
    Atitit 组织架构的如何划分 划分方法attilax大总结
    Atitit 每个人都应该实施的互联网金融战略 attilax总结
    Atitit 研发组织与个人如何gdp计算法 attilax总结
  • 原文地址:https://www.cnblogs.com/hiyang/p/13662432.html
Copyright © 2020-2023  润新知