All sentinels down, cannot determine where is mymaster master is running…
该错是创建redis连接池时调用一个方法导致的,如下:
public static String convertHost(String host) {
return !host.equals("127.0.0.1") && !host.startsWith("localhost") && !host.equals("0.0.0.0") && !host.startsWith("169.254") && !host.startsWith("::1") && !host.startsWith("0:0:0:0:0:0:0:1") ? host : LOCALHOST_STR;
}
原因:
- reids的配置文件
把bind参数配置成了
bind 127.0.0.1
- 还有sentinel 的配置文件
中配置成了
sentinel monitor mymaster 127.0.0.1 6380 1
解决:
- 去掉bind。或者把ip设置成电脑的ip
- sentinel 的配置文件
对应
sentinel monitor mymaster ip 6380 1
配置成1中的ip
详细可以参考:参考文章redis哨兵报错原因