1. 程式人生 > >SELECT is not allowed in cluster (Redis叢集JedisCluster資料庫詳解)

SELECT is not allowed in cluster (Redis叢集JedisCluster資料庫詳解)

(1)redis在單機模式下redis.conf配置檔案中預設的資料庫數量是16個,

 

# Set the number of databases. The default database is DB 0, you can select# a different one on a per-connection basis using SELECT <dbid> where# dbid is a number between 0 and 'databases'-1databases 16

 

(2)在叢集模式下這個配置是不起作用的,叢集客戶端是不支援多資料庫db的,只有一個數據庫預設是SELECT 0;

 

 

127.0.0.1:7005> SELECT 0OK127.0.0.1:7005> SELECT 1(error) ERR SELECT is not allowed in cluster mode


(3)叢集slave從節點預設是不支援讀寫操作的,但是在執行過readonly命令後可以執行讀操作;
--------------------- 
作者:隨風yy 
原文:https://blog.csdn.net/yaomingyang/article/details/79094869