LoginSignup
8
4

More than 5 years have passed since last update.

Redis Cluster構築時のエラーまとめ

Last updated at Posted at 2018-01-25

はじめに

他のRedis構築に関するページは以下をご参考ください。
Redis構築のまとめ

自分がRedis Cluster構築時に出たエラーをまとめました。

環境

CentOS 6.8
Redis 3.2.5
Ruby 2.3.2

エラー一覧

cannot load such file

redis-trib.rb: cannot load such file -- redis (LoadError)
$ gem install redis

で解決する

Redis::Timeoutのエラーが出た場合

gemでインストールしたredisのバージョンに不備がある可能性があるので

$ gem install redis -v 3.2 # 3.2はredisのバージョンに合わせる

でバージョンを合わせる

ERR Slot 16011 is already busy (Redis::CommandError)

[ERR] Node 192.168.56.112:6379 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

CLUSTERを構築するためにslotは確保されている状態になっているので、新しくCLUSTER構築ができなくなっている

主にCLUSTER構築中に中断して再度CLUSTER構築しようとした時に起きる

◯解決方法

redis-cli -h xxx.xxx.xx.xxx -c CLUSTER RESET

を全サーバに対して行う

◯それでも解決しない場合

redis内のdbを空にしてから実行する

$ redis-cli -h 192.168.56.111 -c
192.168.56.111:6379> select 0
OK
192.168.56.111:6379> flushdb
OK
192.168.56.111:6379> flushall
OK

192.168.56.111:6379> exit
$ redis-cli -h xxx.xxx.xx.xxx -c CLUSTER RESET

それでもできない場合はredisのプロセス毎killしてみる

./redis-trib実行しても「・・・」が続いて終わらない

にWaiting for the cluster to join..........................................ってなって終わらない

$ iptables -I INPUT -p tcp -m tcp --dport 16379 --syn -j ACCEPT
$ service iptables save
$ service iptables restart

redisサーバで指定しているポート番号+10000を全サーバで許可しないといけなかった。

○それでも解決しない場合
「/etc/redis/${REDISPORT}.conf」のbindの設定で止まっている可能性がある

$ vim /etc/redis/6379.conf
# bind 127.0.0.1 192.168.56.xxx

bind 192.168.56.xxx 127.0.0.1 #IPアドレスを192.168.56.xxxが先に来るように入れ替えた

○それでも解決しない場合
/etc/redis/6379.conf編集前のプロセスが残っていて設定が反映されていない可能性がある

$ ps aux | grep redis
root      1361  0.0  0.7  40784  7712 ?        Ssl  13:05   0:00 /usr/local/bin/redis-server 192.168.56.112:6379 [cluster]
root      1405  0.0  0.0 103324   904 pts/0    S+   13:12   0:00 grep redis
$ kill 1361

killして再度クラスタ構築すると起動することができた。

8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4