日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

Redis 3.0集群搭建/配置/FAQ

系統(tǒng) 2585 0

·聲明

1,已官網(wǎng)中文教程為基礎(chǔ),邊看邊學(xué),結(jié)合環(huán)境現(xiàn)狀搭建。

2,哥對Ruby不熱愛、不熟悉、不感冒,所述內(nèi)容如有疑義請諒解。

3,3.0官說集群還在測試中,其實(shí)用用也還算馬馬虎虎,對外集群API真心少,望有識(shí)之士能夠出力。

?

·準(zhǔn)備材料

VM9,CentOS 6.4_x86_64(2.6+),SecureCRT,CentOS-6.4-x86_64-bin-DVD1.iso

redis官網(wǎng):redis-3.0.0-beta1.tar.gz

ruby官網(wǎng):rubygems-2.0.7.zip

rubygem官網(wǎng):redis-3.0.7.gem

?

·下鍋

1,把一些基礎(chǔ)包裝一下,后面會(huì)用到

service iptables stop

放入DVD1-

yum install –y gcc*

yum install –y ruby

yum install –y ruby-rdoc

2,裝redis

tar -xvf redis-3.0.0-beta1.tar.gz

cd redis-3.0.0-beta

make

make install

ll /usr/local/bin

3,配置集群(假定 $REDIS_HOME=/root/soft/redis,就像ORACLE_HOME一樣)

cd $REDIS_HOME

mkdir cluster-test

cd cluster-test

mkdir 7000 7001 7002 7003 7004 7005

vim redis.conf,修改內(nèi)容如下:

port 7000 個(gè)性化

      cluster-
      
        enabled yes

cluster
      
      -config-file nodes.
      
        7000
      
      
        .conf 個(gè)性化

cluster
      
      -node-timeout 
      
        5000
      
      
        

appendonly yes

appendfilename 
      
      
        "
      
      
        appendonly.7000.aof
      
      
        "
      
      
         個(gè)性化

deamonize yes

pidfile 個(gè)性化

log 個(gè)性化
      
    

?

cp ../redis.conf ./7000

cp ../redis.conf ./7001

cp ../redis.conf ./7002

cp ../redis.conf ./7003

cp ../redis.conf ./7004

cp ../redis.conf ./7005

cp /usr/local/bin/redis-server ./7000

cp /usr/local/bin/redis-server ./7001

cp /usr/local/bin/redis-server ./7002

cp /usr/local/bin/redis-server ./7003

cp /usr/local/bin/redis-server ./7004

cp /usr/local/bin/redis-server ./7005

/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7000/redis.conf

/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7001/redis.conf

/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7002/redis.conf

/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7003/redis.conf

/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7004/redis.conf

/root/soft/redis/cluster-test/redis-server /root/soft/redis/cluster-test/7005/redis.conf

如果需要看一看:ps –ef|grep redis

如果需要?dú)⒁粴ⅲ簆s -ef|grep redis|egrep -v grep|awk -F ' ' '{print $2}'|xargs kill -9

4,配置ruby集群腳本

cd /root/soft/rubygems

ruby setup.rb

到redis-3.0.7.gem路徑下

gem install -l redis(不用L的話,走ruby官網(wǎng),95%被WALL,你懂得,自己改source吧)

./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7002 127.0.0.3:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7005(半路記得“yes"一下)

      >>>
      
         Creating cluster

Connecting to node 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7000
      
      
        : OK

Connecting to node 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7001
      
      
        : OK

Connecting to node 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7002
      
      
        : OK

Connecting to node 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      
        : OK

Connecting to node 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7004
      
      
        : OK

Connecting to node 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7005
      
      
        : OK


      
      >>> Performing hash slots allocation on 
      
        6
      
      
         nodes...

Using 
      
      
        3
      
      
         masters:


      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7000
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7001
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7002
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7000
      
       replica #
      
        1
      
      
        is
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7001
      
       replica #
      
        1
      
      
        is
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7004
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7002
      
       replica #
      
        1
      
      
        is
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7005
      
      
        

M: bc66d90ca24eb6b69a3b375a4e242fef00de2052 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7000
      
      
        

   slots:
      
      
        0
      
      -
      
        5460
      
       (
      
        5461
      
      
         slots) master

M: bc66d90ca24eb6b69a3b375a4e242fef00de2052 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7001
      
      
        

   slots:
      
      
        5461
      
      -
      
        10921
      
       (
      
        5461
      
      
         slots) master

M: bc66d90ca24eb6b69a3b375a4e242fef00de2052 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7002
      
      
        

   slots:
      
      
        10922
      
      -
      
        16383
      
       (
      
        5462
      
      
         slots) master

S: bc66d90ca24eb6b69a3b375a4e242fef00de2052 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      
        

   replicates bc66d90ca24eb6b69a3b375a4e242fef00de2052

S: bc66d90ca24eb6b69a3b375a4e242fef00de2052 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7004
      
      
        

   replicates bc66d90ca24eb6b69a3b375a4e242fef00de2052

S: bc66d90ca24eb6b69a3b375a4e242fef00de2052 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7005
      
      
        

   replicates bc66d90ca24eb6b69a3b375a4e242fef00de2052

Can I 
      
      
        set
      
       the above configuration? (type 
      
        '
      
      
        yes
      
      
        '
      
      
         to accept): yes


      
      >>>
      
         Nodes configuration updated


      
      >>>
      
         Sending CLUSTER MEET messages to join the cluster

Waiting 
      
      
        for
      
      
         the cluster to join...


      
      >>> Performing Cluster Check (
      
        using
      
       node 
      
        127.0
      
      .
      
        0.1
      
      :
      
        7000
      
      
        )

M: 75bab28893c3536aecdb9879df97db89b24ce21e 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7000
      
      
        

   slots:
      
      
        5461
      
      -
      
        10921
      
       (
      
        5461
      
      
         slots) master

M: cfc344721cad8a5ddb7a8d675eb3a4d6e5b9d1c1 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7002
      
      
        

   slots:
      
      
        10922
      
      -
      
        16383
      
       (
      
        5462
      
      
         slots) master

M: 01b3977a3f592fd1538e8c83f86bbba37d0c1058 
      
      
        127.0
      
      .
      
        0.3
      
      :
      
        7003
      
      
        

   slots:
      
      
        0
      
      -
      
        5460
      
       (
      
        5461
      
      
         slots) master

M: df59fce238a1c538933bdc170edb27835d0b7cc7 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7004
      
      
        

   slots: (
      
      
        0
      
      
         slots) master

   replicates 01b3977a3f592fd1538e8c83f86bbba37d0c1058

M: b6bdb2d309aa7f0b810288f24e975230419f25b1 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7005
      
      
        

   slots: (
      
      
        0
      
      
         slots) master

   replicates 75bab28893c3536aecdb9879df97db89b24ce21e

M: b6bdb2d309aa7f0b810288f24e975230419f25b1 
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7005
      
      
        

   slots: (
      
      
        0
      
      
         slots) master

   replicates cfc344721cad8a5ddb7a8d675eb3a4d6e5b9d1c1

[OK] All nodes agree about slots configuration.


      
      >>> Check 
      
        for
      
      
         open slots...


      
      >>>
      
         Check slots coverage...

[OK] All 
      
      
        16384
      
       slots covered.
    

??redis-cli -c -p 7000

      
        127.0
      
      .
      
        0.1
      
      :
      
        7000
      
      > 
      
        set
      
      
         b c


      
      -> Redirected to slot [
      
        3300
      
      ] located at 
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      
        

OK


      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      > 
      
        set
      
      
         hello world

OK


      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      > 
      
        get
      
      
         foo


      
      -> Redirected to slot [
      
        12182
      
      ] located at 
      
        127.0
      
      .
      
        0.1
      
      :
      
        7002
      
      
        

(nil)


      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7002
      
      > 
      
        get
      
      
         hello


      
      -> Redirected to slot [
      
        866
      
      ] located at 
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      
        "
      
      
        world
      
      
        "
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      > 
      
        get
      
      
         b


      
      
        "
      
      
        c
      
      
        "
      
      
        127.0
      
      .
      
        0.1
      
      :
      
        7003
      
      > 
    

?

·FAQ

      *** ERROR: Invalid configuration 
      
        for
      
      
         cluster creation.




      
      *** Redis Cluster requires at least 
      
        3
      
      
         master nodes.




      
      *** This 
      
        is
      
       not possible with 
      
        4
      
       nodes and 
      
        1
      
      
         replicas per node.




      
      *** At least 
      
        6
      
       nodes are required.
    

?

·Redis官說,至少3+3,還延續(xù)著Master-Slave的設(shè)計(jì)理念,這點(diǎn)上個(gè)人覺得Cassandra的一致性確實(shí)了得。

?

      Either the node already knows other nodes
    

?

·因?yàn)閳?bào)錯(cuò)是ruby報(bào)的,不太能夠理解其意思,因?yàn)槲抑白隽诵﹩螜C(jī)壓測,可能直接疊上集群會(huì)有垃圾數(shù)據(jù),所以把/var/db/和/var/log/下能清空的都清空了。

?

      [
      
        13321
      
      ] 
      
        09
      
       Mar 
      
        08
      
      :
      
        09
      
      :
      
        24.290
      
       # Handshake error: we already know node bc66d90ca24eb6b69a3b375a4e242fef00de2052, updating the address 
      
        if
      
       needed.
    

?

·同樣道理,ruby報(bào)的錯(cuò),一開始一直在join被我ctrl+c之后開始報(bào)錯(cuò),用上面的方法無果。把所有app目錄清空然后redis重裝。大家測試時(shí),最后事先vmware快照一下或者redis現(xiàn)網(wǎng)數(shù)據(jù)備份一下。

?

·OK,自己爽一下吧

?

Redis 3.0集群搭建/配置/FAQ


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會(huì)非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 香港 | 镇雄县| 古浪县| 井研县| 莆田市| 华阴市| 和田市| 察隅县| 东丽区| 吴堡县| 蒙城县| 青浦区| 剑川县| 郯城县| 清苑县| 岗巴县| 广汉市| 太仓市| 麟游县| 鹿泉市| 嵩明县| 外汇| 涟源市| 张家川| 全州县| 高雄县| 隆林| 平罗县| 东乌珠穆沁旗| 武汉市| 阳东县| 油尖旺区| 略阳县| 武乡县| 平舆县| 莲花县| 修水县| 阜康市| 山东| 清新县| 运城市|