博客
关于我
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 中的多层for in嵌套循环使用
    查看>>
    Python 中的多线程(01/4)
    查看>>
    Python 中的多进程(01/2):简介
    查看>>
    Python 中的多进程(02/2):进程之间的通信)
    查看>>
    Python 中的字符串、列表、元组和字典数据类型的特点和使用场景
    查看>>
    Python 中的属性访问器是什么?如何使用 @property 装饰器?
    查看>>
    Python 中的带宽限制
    查看>>
    Python 中的机器学习简介:多项式回归
    查看>>
    python读取grib2数据_用Python加载grib2文件
    查看>>
    Python 中的注意点_s2
    查看>>
    Python读取Excel的几种工具包(附Demo)
    查看>>
    Python 中的生成器是什么?
    查看>>
    Python 中的离线语音转文本
    查看>>
    Python读写json文件的简单实现
    查看>>
    Python 中的线程
    查看>>
    Python 中的继承机制是什么样的?
    查看>>
    python读写excel之xlrd&xlwt&xlutils组合
    查看>>
    Python 中的装饰器是什么?
    查看>>
    Python 中的装饰器是如何工作的,有哪些实际应用场景?
    查看>>
    python读excel
    查看>>