zoukankan      html  css  js  c++  java
  • redis分区-官方支持cluster

    一、参考资料:http://redis.cn/topics/cluster-tutorial.html

    二、通过源码utils中的脚本创建示例

    如:/opt/redis-6.0.8/utils/create-cluster

    里面也有个README,先看这个文件

    1. Edit create-cluster and change the start / end port, depending on the
    number of instances you want to create.
    2. Use "./create-cluster start" in order to run the instances.
    3. Use "./create-cluster create" in order to execute redis-cli --cluster create, so that
    an actual Redis cluster will be created. (If you're accessing your setup via a local container, ensure that the CLUSTER_HOST value is changed to your local IP)
    4. Now you are ready to play with the cluster. AOF files and logs for each instances are created in the current directory.
    

     

    按步骤执行:

    1、第一步就先不改了

    2、./create-cluster start

    3、./create-cluster create

     4、通过客户端连接

    redis-cli -c -p 30001

    5、随便执行下命令,发现会自动转移到不同的节点,说明这边的路由功能是在单个节点中实现的

    6、停止并清空服务

    ./create-cluster stop
    ./create-cluster clean

    三、改用命令启动

    1、查看下相关的命令

    redis-cli --cluster help

    2、还是通过脚本启动6个节点

    ./create-cluster start

    3、通过命令创建cluster

    redis-cli --cluster create 127.0.0.1:30001 127.0.0.1:30002 127.0.0.1:30003 127.0.0.1:30004 127.0.0.1:30005 127.0.0.1:30006 --cluster-replicas 1

     4、一样的效果

    四、通过服务启动,这个就不写了,研究下参考资料的页面吧,毕竟是作为架构学习的,这东西属于运维的会更多

  • 相关阅读:
    4K
    4J
    4C
    I2C总线的仲裁机制
    Linux C中strcpy , strncpy , strlcpy 的区别
    Linux下的USB总线驱动(一)
    C/C++ 语言中的表达式求值
    const变量通过指针修改问题
    关于协议栈XDATA,内存溢出的小结
    Ubuntu安装ssh,及失败解决方案
  • 原文地址:https://www.cnblogs.com/gabin/p/13676221.html
Copyright © 2011-2022 走看看