博客
关于我
Redis专题(十二)-Redis集群
阅读量:120 次
发布时间:2019-02-26

本文共 2395 字,大约阅读时间需要 7 分钟。

Redis ?????????

1. Redis ????

Redis ??????

Redis ?????????????? Redis ????????????????????????????????????

  • ??????? Redis ????????? PING-PONG ????????????????????????????
  • ???????????????????????cluster-node-timeout?????????????????????????????????
  • ?????????????? Redis ????????? proxy ???????????????
  • ??????Redis ???? 16384 ?????????????????????????????????

??????

? Redis ??????????????

  • ????? key ?? crc16 ????????
  • ????? 16384 ?????????? 0-16383 ?????? ID?
  • ???????????????????????????
  • 2. Redis ??????

    ????

    ?????????master????????????????????????????????????????????cluster_state: fail???????

    • ?????????????????????slave??
    • ???????????????????????

    ??????

    ???????????????

    127.0.0.1:7003> cluster info

    ?????

    cluster_state: okcluster_slots_assigned: 16384cluster_slots_ok: 16384cluster_slots_pfail: 0cluster_slots_fail: 0cluster_known_nodes: 6cluster_size: 3cluster_current_epoch: 6cluster_my_epoch: 3cluster_stats_messages_sent: 926cluster_stats_messages_received: 926

    3. ?? Redis ??

    ????

    • ??????? Ruby ???
    • ?????
      yum install rubyyum install rubygems
    • ?????? Redis-3.0.0.gem???????????
      gem install /usr/local/redis-3.0.0.gem
    • ??????????????? /usr/local/redis/redis-cluster ???

    ??????

  • ???????
    [root@A001 redis-cluster]# cp 7001/ 7002 -r[root@A001 redis-cluster]# cp 7001/ 7003 -r[root@A001 redis-cluster]# cp 7001/ 7004 -r[root@A001 redis-cluster]# cp 7001/ 7005 -r[root@A001 redis-cluster]# cp 7001/ 7006 -r
  • ???????
    • ?? Redis ??????????????
  • ?????
    [root@A001 redis-cluster]# ./startall.sh
  • ?????
    [root@A001 redis-cluster]# ./redis-trib.rb create --replicas 1 192.168.242.137:7001 192.168.242.137:7002 192.168.242.137:7003 192.168.242.137:7004 192.168.242.137:7005 192.168.242.137:7006
  • 4. ????

    ????

    • ??????
      ./redis-trib.rb add-node 127.0.0.1:7007 127.0.0.1:7001
    • ???????
      127.0.0.1:7003> cluster nodes
    • ??????
      ./redis-trib.rb add-node --slave --master-id 
      192.168.101.3:7008 192.168.101.3:7001

    ###????

    • ????????
      127.0.0.1:7003> cluster slots
    • ????
      ./redis-trib.rb reshard 192.168.101.3:7001 500 15b809eadae88955e36bcdbb8144f61bbbaf38fb all yes

    5. ?????

    ?????

    • ?????
      ./redis-cli -h 127.0.0.1 -p 7001 -c
    • ???????
      ./redis-cli -h 127.0.0.1 -p 7001 -c

    ????

    • ???????
      127.0.0.1:7003> cluster info
    • ???????
      127.0.0.1:7003> cluster nodes

    6. ?????

    ????

    • ?????
      ./redis-trib.rb del-node 127.0.0.1:7005 4b45eb75c8b428fbd77ab979b85080146a9bc017
    • ????????????????????????

    ?????????????? Redis ??????????????????????????

    转载地址:http://ysdu.baihongyu.com/

    你可能感兴趣的文章
    python读取word表格内容(1)
    查看>>
    python 中os.path.join 双斜杠的解决办法
    查看>>
    python 中PIL.Image和OpenCV图像格式相互转换
    查看>>
    Python 中Semaphore 信号量对象、Event事件、Condition
    查看>>
    python 中with的使用及样例
    查看>>
    python读取wav文件并播放[pyaudio/wave]
    查看>>
    python读取txt文件的行数
    查看>>
    Python 中内置的最大堆 API
    查看>>
    Python 中只有一个 True 和一个 False 对象吗?
    查看>>
    python读取mtcars数据集并实现以下操作_关于数据处理。。,Python交流,技术交流区,鱼C论坛 - Powered by Discuz!...
    查看>>
    Python 中多线程与多处理之间的区别
    查看>>
    Python 中如何使用 lambda 函数
    查看>>
    Python 中如何创建多行字符串?
    查看>>
    Python 中如何处理异常?
    查看>>
    Python 中如何实现列表的切片?
    查看>>
    Python 中如何实现字典的排序?
    查看>>
    Python 中常用的数据类型及相关操作详解
    查看>>
    python 中文乱码
    查看>>
    Python 中生成器与普通函数的区别
    查看>>
    Python 中的 *tuple 和 **dict 是什么意思?
    查看>>