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、一样的效果

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

  • 相关阅读:
    SQL入门学习4-复杂查询
    SQL入门学习3-数据更新
    SQL入门学习2-聚合与排序
    SQL入门学习1-查询基础
    SQL入门学习0-数据库与SQL
    Exp9 20155218 Web安全基础实践
    20155218《网络对抗》Exp8 Web基础
    # 20155218 徐志瀚 EXP7 网络欺诈
    Exp6 20155218 信息搜集与漏洞扫描
    20155218《网络对抗》MSF基础应用
  • 原文地址:https://www.cnblogs.com/gabin/p/13676221.html
Copyright © 2011-2022 走看看