• Redis集群搭建


    Redis集群搭建准备工作

    1.redis集群管理工具redis-trib.rb依赖ruby环境,首先需要安装ruby环境。

      [root@redis01 bin]# yum install ruby

      [root@redis01 bin]# yum install rubygems

    2.安装ruby和redis的接口程序

      [root@redis01 local]# gem install /usr/local/redis-3.0.0.gem

    3.将Redis集群搭建脚本文件复制到/usr/local/redis19/redis-cluster/目录下

       [root@redis01 download]# cp /usr/local/download/redis-3.0.0.gem  /usr/local/redis19/redis-cluster/ 

    Redis集群搭建步骤

    第一步:创建6个redis实例,需要端口号7001~7006

      [root@redis01 redis19]# cp ./redis/ ./redis-cluster/7001

      ......

      [root@redis01 redis19]# cp ./redis/ ./redis-cluster/7006

    第二步:修改redis.conf配置文件,打开Cluster-enable yes

         [root@redis01 redis19]# vim ./7001/redis.conf

      打开后修改Cluster-enable为yes

    第三步:启动所有的实例

      写个启动脚本如下:start-all.sh

      

    cd 7001
    ./redis-server redis.conf
    cd ..
    cd 7002
    ./redis-server redis.conf
    cd ..
    cd 7003
    ./redis-server redis.conf
    cd ..
    cd 7004
    ./redis-server redis.conf
    cd ..
    cd 7005
    ./redis-server redis.conf
    cd ..
    cd 7006
    ./redis-server redis.conf
    cd .. 

      停止脚本如下:stop-all.sh

    cd 7001
    ./redis-cli -p 7001 shutdown
    cd ..
    cd 7002
    ./redis-cli -p 7002 shutdown
    cd ..
    cd 7003
    ./redis-cli -p 7003 shutdown
    cd ..
    cd 7004
    ./redis-cli -p 7004 shutdown
    cd ..
    cd 7005
    ./redis-cli -p 7005 shutdown
    cd ..
    cd 7006
    ./redis-cli -p 7006 shutdown
    cd ..

    第四步:创建集群

      [root@redis01 redis19]# ./redis-trib.rb create --replicas 1 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005  127.0.0.1:7006

      看到这个结果就表示集群创建成功了:[OK] All 16384 slots covered.

      如果已经创建过了,就没必要继续创建了,否则会有如下提示:

      [ERR] Node 127.0.0.1:7001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

    第五步:访问集群

      [root@redis01 7001]# ./redis-cli -p 7001 -c

      查看集群信息:cluster info

    127.0.0.1:7001> cluster info
    cluster_state:ok
    cluster_slots_assigned:16384
    cluster_slots_ok:16384
    cluster_slots_pfail:0
    cluster_slots_fail:0
    cluster_known_nodes:6
    cluster_size:3
    cluster_current_epoch:6
    cluster_my_epoch:1
    cluster_stats_messages_sent:953
    cluster_stats_messages_received:953

      查看集群信息:cluster nodes

    127.0.0.1:7001> cluster nodes
    f0e782baa6da587b9929ea2c5dd01e61b0bcade0 192.168.56.101:7006 slave fc1a95daa8f2cae63cee289ec9700745563edc6d 0 1517083778590 6 connected
    fc1a95daa8f2cae63cee289ec9700745563edc6d 192.168.56.101:7003 master - 0 1517083780615 3 connected 10923-16383
    2dd708f8f8ffc5ce72153121835c3f72c4e6b736 192.168.56.101:7005 slave a32f74261aeb89ddfea2ba12a13df3e7bd5da069 0 1517083783647 5 connected
    565763cd0de567c301e9aca3d20a7551c02f4be2 192.168.56.101:7001 myself,master - 0 0 1 connected 0-5460
    a32f74261aeb89ddfea2ba12a13df3e7bd5da069 192.168.56.101:7002 master - 0 1517083781626 2 connected 5461-10922
    ed1f9d45b54a534625dd522342adfd153a7483c7 192.168.56.101:7004 slave 565763cd0de567c301e9aca3d20a7551c02f4be2 0 1517083782635 4 connected

      共有三组:

      master 7001 slave 7004

      master 7002 slave 7005

      master 7003 slave 7006

  • 相关阅读:
    {转}:Qualcomm整合SRS音频技术于其最新参考设计架构SRS
    语音库
    {转}:Digium和Dialogic在最近发布的产品中强调高清语音
    ICASSP2010Nokia研究中心对各种语音编码器进行主观测评的结果:
    MPEG 工作组会议进程
    加拿大在音频压缩算法和处理技术上有相当的研究和应用
    POLAQ :FAQ(注意,是ITU标准,但并不开源)
    语音编解码技术公司介绍(一):Digital Voice Systems, Inc. (DVSI)
    RALCWI(Robust Advanced Low Complexity Waveform Interpolation):
    G.723.1编解码器工程
  • 原文地址:https://www.cnblogs.com/fengyan20150508/p/8934258.html
Copyright © 2020-2023  润新知