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

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

  • 相关阅读:
    shell面试题整理
    用循环链表实现Josephus问题
    in与exists的区别
    单链表的建立/测长/打印/删除/排序/逆序/寻找中间值
    float在内存中的存放
    crontab定时任务详解
    螺旋队列问题之二
    螺旋队列问题之一
    android网络编程--从网络下载图片,并保存到内存卡
    android Shader类简介_渲染图像示例
  • 原文地址:https://www.cnblogs.com/gabin/p/13676221.html
Copyright © 2011-2022 走看看