那些年踩过的坑之Redis报错:All sentinels down, cannot determine where is mymaster master is running...
1. 异常信息: All sentinels down, cannot determine where is mymaster master is running...
通过测试:
@Test
public void testSentinel(){
HashSet<String> sentinels = new HashSet<>();
sentinels.add("192.168.72.129:26379");
JedisSentinelPool pool = new JedisSentinelPool("mymaster", sentinels);
Jedis jedis = pool.getResource();
jedis.set("hello", "world");
System.out.println(jedis.get("hello"));
}
报出错误:
警告: Cannot get master address from sentinel running @ 192.168.72.129:26379.
Reason: redis.clients.jedis.exceptions.JedisConnectionException:
Failed connecting to host 192.168.72.129:26379. Trying next one.
redis.clients.jedis.exceptions.JedisConnectionException:
All sentinels down, cannot determine where is mymaster master is running...
(哨兵宕机, 不能确定主机位置)
还原报错现场:
学习搭配redis过程中, 在linux虚拟机上配置完redis-sentinel( 即启用redis哨兵配置搭建1主2从的redis服务器 )
开启了redis-sentinel服务, ip和port号为: 192.168.72.129:26379
首先, 能确定的是, linux防火墙已然关闭, sentinel.conf 的配置中, (注释掉bind)开放了不同主机的访问, 同时, redis的保护模式也已经关闭!!!
但是jedis连接还是出现了问题, 那么既然不是redis服务器方配置或者防护的问题, 那么问题只能出在了我的操作系统win7中!!!
在此基础上猜测, 是否是ip 连接 或者 是端口未开放呢?
于是通过以下操作:
cmd ->
telnet 192.168.72.129:26379
显示错误: 正在连接192.168.72.129:26379...无法打开到主机的连接。 在端口 23: 连接失败
------- 附win7中开启telnet的方法: 站内他人博文链接:https://www.cnblogs.com/ylcms/p/7250129.html, 博主:云龙笔记

看样子应该是linux的端口未开放导致无法连接.
继续, 查看linux服务端:
通过 netstat 查看与26379相关的端口信息, 查询到:

怎么回事? 端口好好地, 已经被redis服务监听了!!!
哎, 这时脑袋升起一丝不详的感觉, 难道是我的主从redis都没有启动, 而我直接加载了哨兵的配置吗?

哇的一声哭了出来, 忙活了这么久, 居然是我并没有启动主从机. 导致了这一系列bug!!!!
开启, 然后跑一下测试类, 再看看结果, 如下

连接正常...
虽然导致bug的问题如此"脑残", 不过从这过程之中, 我也对redis的分片, 乃至哨兵有了一个全面的认识, 算是祸福相依啦. 如果你也有连接redis的错误, 不妨跟我的思路来思考, 相信不难解决!
---记录2019年7月29日12:31:11
那些年踩过的坑之Redis报错:All sentinels down, cannot determine where is mymaster master is running...的更多相关文章
- mac brew install redis 报错
mac brew install redis 报错 /usr/local/opt/php55/bin/phpize /usr/local/opt/php55/bin/phpize: line 61: ...
- redis报错Windows error 0x70(a large memory)
redis报错Windows error 0x70 redis 嫌弃你内存不够了,就给你不开第二个实例. The Windows version of Redis allocates a large ...
- filebeat output redis 报错 i/o timeout
filebeat output redis 报错 i/o timeout 先把报错内容贴出来. ERROR redis/client. go: Failed to RPUSH to redis li ...
- window下安装redis报错: creating server tcp listening socket 127.0.0.1:6379: bind No error
window下安装redis报错: creating server tcp listening socket 127.0.0.1:6379: bind No error 解决: 如果没有配置环境,在安 ...
- Redis报错 : (error) NOAUTH Authentication required.
原文:Redis报错 : (error) NOAUTH Authentication required. 这个错误是因为没有用密码登陆认证 , 先输入密码试试 . 127.0.0.1:6379> ...
- Windows安装redis报错处理(转!)
要谈则谈,要打便打! ---2019.5.9,贸易战 转自:http://www.yayihouse.com/yayishuwu/chapter/1297 安装redis报错信息 [9204] 15 ...
- redis报错解决
1.Connecting to node 127.0.0.17000 [ERR] Sorry, can't connect to node 192.168.1.917000 redis集群:Conne ...
- 安装Redis-cluster-gem install redis报错的解决方案
错误描述: [root@eshop-cache01 local]# gem install redis ERROR: Loading command: install (LoadError) cann ...
- docker启动redis报错 oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
docker启动redis报错 1:C 17 Jun 08:18:04.613 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo1:C 17 Jun 08 ...
随机推荐
- Bootstrap-轮播图-No.4
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...
- uni-app引入css动画库
引入Animate动画库 Animate中文网地址:http://www.animate.net.cn/ Animate下载地址:https://daneden.github.io/animate.c ...
- C和汇编混联合的问题
关键时刻出现了问题: 关于packed的问题,一定要注意这个问题http://stackoverflow.com/questions/4306186/structure-padding-and-str ...
- eclipse运行内存超出
问题分析: 1:可能是eclipse自身的运行内存不够 2:可能是java中的jre内存不够 修改方法: 1 改eclipse的运行内存 在eclipse.ini文件中 -startupplugins ...
- 第三章 python数据规整化
本章概要 1.去重 2.缺失值处理 3.清洗字符型数据的空格 4.字段抽取 去重 把数据结构中,行相同的数据只保留一行 函数语法: drop_duplicates() #导入pandas包中的read ...
- python 快速排序-代码示例
def quick_sort(alist, first, last): if first >= last: # 如果开始等于结尾,即就一个元素 return mid_value = alist[ ...
- golang中遍历汇总
直接上例子: 例子1: package main import( "fmt" ) func main(){ a := map[string]string{ "alice& ...
- 利用JDK自带工具监控JVMCPU和内存指标
特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...
- 前端知识点回顾——Javascript篇(六)
fetch 在原生ajax+es6promise的基础上封装的一个语法糖,返回promise对象. fetch(url, initObj) .then(res=>res.json()) .the ...
- React Native中Navigator的安装与使用
一.安装Navigator 1.安装react-native-deprecated-custom-components npm install react-native-deprecated-cust ...