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
    
  • 相关阅读:
    python3下搜狗AI API实现
    辽宁移动宽带体验及魔百盒M101s-2刷机
    年会抽奖系统-支持作弊,指定中奖
    论python3下“多态”与“继承”中坑
    fiddler抓手机报文的配置指南
    微软BI套件
    IntelliJ IDEA 2018 Community(社区版)创建J2EE项目+Tomcat9部署
    Spring.net的Demo项目,了解什么是控制反转
    manjaro安装virtualbox教程
    Debian9 安装后的配置笔记
  • 原文地址:https://www.cnblogs.com/hiyang/p/13662432.html
Copyright © 2011-2022 走看看