redis羣集搭建問題總結

1 配置文件:redis可以只有一份,根據多個配置文件進行羣集的配置


2 數據問題:數據問題 [ERR] Node 10.1.52.97:7000 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

    將原來的redis數據清空,在進行羣集的配置


3 配置文件參數:
    port  7000                              //端口7000,7002,7003        
    bind 本機ip                             //默認ip爲127.0.0.1 需要改爲其他節點機器可訪問的ip 否則創建集羣時無法訪問對應的端口,無法創建集羣
    daemonize    yes            //redis後臺運行
    pidfile  /var/run/redis_7000.pid        //pidfile文件對應7000,7001,7002。這個可不用配置
    cluster-enabled  yes                    //開啓集羣  把註釋#去掉
    cluster-config-file  nodes_7000.conf    //集羣的配置  配置文件首次啓動自動生成 7000,7001,7002
    cluster-node-timeout  15000             //請求超時  默認15秒,可自行設置

    appendonly  yes                         //aof日誌開啓  有需要就開啓,它會每次寫操作都記錄一條日誌


4 ruby問題:
    yum -y install ruby ruby-devel rubygems rpm-build
    gem install redis

5 舊羣集文件干擾
    /usr/local/share/gems/gems/redis-3.3.3/lib/redis/client.rb:121:in `call': ERR Slot 9189 is already busy (Redis::CommandError)
    有這個報錯表示舊的羣集文件有問題,需要將其刪掉 nodes_7000.conf
    刪掉之後恢復正常

6 eclipse連接問題:
    建立完羣集後,只能用jedis連接主節點,連其他報錯
    Jedis jedis = new Jedis("10.1.52.97", 7000);
    JedisPool pool = new JedisPool("10.1.52.97", 7000);
發佈了52 篇原創文章 · 獲贊 22 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章