redis報錯總結

來源:互聯網
上載者:User
1、 undefined reference to `clock_gettime' 連結錯誤的解決辦法
安裝redis時,編譯檔案 make 該redis檔案夾出現此錯誤,clock_gettime在即時庫librt(real time)裡面,由於連結的時候沒有連結這個庫導致報錯。
解決思路:
只需在我們啟動並執行Makefile檔案裡面添加動態連結程式庫librt ( -lrt ) ,重新編譯即可。 操作步驟:
(1)尋找即時庫librt所在路徑:
命令
find / -name '*librt*'
/usr/lib/librt.so (需對應本機所在檔案位置)
(2)開啟 /home/wm/redis-3.2.7 路徑下的Makefile檔案:
vim /home/wm/redis-3.2.7/Makefile
(3)修改Makefile檔案配置:
105 ifeq ($(MALLOC),jemalloc)  
106     DEPENDENCY_TARGETS+= jemalloc  
107     FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include  
108     FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a  
109     FINAL_LIBS+=  /usr/lib/librt.so  #此路徑加上librt.so#  
110 endif
(4)執行:wq命令儲存退出,重新編譯即可
 2、 [ERR] Node is not empty. Either the node already knows other nodes (check with C

[root@node00 src]# ./redis-trib.rb add-node --slave --master-id4f6424e47a2275d2b7696bfbf8588e8c4c3a5b95 172.168.63.202:7001172.168.63.202:7000

......

[OK] All nodes agree about slotsconfiguration.

>>> Check for open slots...

>>> Check slots coverage...

[OK] All 16384 slots covered.

Connecting to node 172.168.63.202:7001: OK

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

解決方案:

1)、將需要新增的節點下aof、rdb等本地備份檔案刪除;

2)、同時將新Node的叢集設定檔刪除,即:刪除你redis.conf裡面cluster-config-file所在的檔案;

3)、再次添加新節點如果還是報錯,則登入新Node,./redis-cli–h x –p對資料庫進行清除:

172.168.63.201:7001>  flushdb      #清空當前資料庫

通過以上解決方案中的1)、2)或者3)之後再執行指令碼,成功執行;


3、Not all 16384 slots are covered by nodes.

[root@node01 src]# ./redis-trib.rb check172.168.63.202:7000


Connecting to node 172.168.63.202:7000: OK

Connecting to node 172.168.63.203:7000: OK

Connecting to node 172.168.63.201:7000: OK

>>> Performing Cluster Check(using node 172.168.63.202:7000)

M: 449de2d2a4b799ceb858501b5b78ab91504c72e0172.168.63.202:7000

  slots: (0 slots) master

   0additional replica(s)

M: db9d26b1d15889ad2950382f4f32639606f9a94b172.168.63.203:7000

  slots: (0 slots) master

   0additional replica(s)

M: f90924f71308eb434038fc8a5f481d3661324792172.168.63.201:7000

  slots: (0 slots) master

   0additional replica(s)

[OK] All nodes agree about slotsconfiguration.

>>> Check for open slots...

>>> Check slots coverage...

[ERR] Not all 16384 slots are covered by nodes.


原因:

這個往往是由於主node移除了,但是並沒有移除node上面的slot,從而導致了slot總數沒有達到16384,其實也就是slots分布不正確。所以在刪除節點的時候一定要注意刪除的是否是Master主節點。

1)、官方是推薦使用redis-trib.rb fix 來修複叢集…. ….  通過cluster nodes看到7001這個節點被幹掉了… 那麼

[root@node01 src]#  ./redis-trib.rb fix 172.168.63.201:7001


修複完成後再用check命令檢查下是否正確

[root@node01 src]# ./redis-trib.rb check172.168.63.202:7000

只要輸入任意叢集中節點即可,會自動檢查所有相關節點。可以查看相應的輸出看下是否是每個Master都有了slots,如果分布不均勻那可以使用下面的方式重新分配slot:

[root@node01 src]#  ./redis-trib.rb reshard 172.168.63.201:7001

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.