ERR SELECT is not allowed in cluster mode: SELECT is not allowed in cluster mode(クラスタモードでは SELECT は許可されない)
Redis意味
Redis Cluster モードで、SELECT により別の論理データベース (DB インデックス) に切り替えようとした。クラスタモードはデータベース 0 のみをサポートし、複数の DB は使用できない。
原因
スタンドアロン Redis で SELECT により DB 0-15 を切り替えていたアプリケーションが、Redis Cluster への移行後も同じコマンドを送り続けている。クラスタアーキテクチャはデータをスロット単位で分散するため、複数 DB の概念はサポートされない。
対処方法
クラスタモードでは SELECT の呼出しを削除する。使用されるのは DB 0 のみ。論理的な分離が必要な場合はキープレフィックス (名前空間) を使用する (例: app1:key)。特定のキーをまとめて処理する必要がある場合は、ハッシュタグ ({user123}) を使用して同じスロットに配置する。アプリケーションの構成をクラスタ対応にする。
同じデータベースの他の項目
- NOTBUSY No scripts in execution right nowNo scripts in execution right now(現在実行中のスクリプトはない)
- DENIED Redis is running in protected modeRedis is running in protected mode(Redis は保護モードで稼働中)
- ERR Can't execute '<cmd>': only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this contextCommand not allowed in subscribe context(subscribe コンテキストでは許可されないコマンド)
- ERR wrong number of arguments for commandWrong number of arguments for command(コマンドの引数の数が誤っている)
- ERR Background save already in progressBackground save already in progress(バックグラウンド保存が既に進行中)
- ERR bit offset is not an integer or out of rangeBit offset is not an integer or out of range(ビットオフセットが整数でないか範囲外)
- ERR Protocol error: invalid multibulk lengthProtocol error: invalid multibulk length(プロトコルエラー: 無効な multibulk 長)