博客
关于我
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与C#之间内存共享互传信息
    查看>>
    python与c语言混合编程_你试过C语言和Python一起混合编程吗?两者相加不是已经无敌了!...
    查看>>
    python与excel
    查看>>
    Python与Excel的完美邂逅:深入浅出,手把手教你轻松玩转Excel数据操作
    查看>>
    python与flask_Python编程中flask的简介与简单使用
    查看>>
    python与图灵机器人交互(WXPY版本)
    查看>>
    python与运算符_python运算符
    查看>>
    python两个列表获取交集,并集,差集
    查看>>
    python两个字典合并,两个list合并
    查看>>
    Python两个版本共存时,命令行升级pip
    查看>>
    Python两个版本共存时,怎么验证是否安装成功 scrapy
    查看>>
    Python两个版本共存时,通过pip安装Scrapy
    查看>>
    python两组变量的相关关系散点图_变量是什么?变量间的两种关系——函数关系和相关关系(小学版)...
    查看>>
    Python中 pass语句的作用
    查看>>
    python中 urllib, urllib2, httplib, httplib2 几个库的区别
    查看>>
    python中 yaml库 & json库 & xmltodict库使用
    查看>>
    python中 将你的名字转化成为二进制并输出
    查看>>
    Python中*args 和**kwargs的用法
    查看>>
    Python中*args 和**kwargs的用法
    查看>>
    Python中*args和**kwargs的使用
    查看>>