那些年踩过的坑之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 ...
随机推荐
- mysql_config_editor设置
[root@node01 etc]# mysql_config_editor set -G mysql3307 -S /tmp/mysql3307.sock -uroot -pEnter passwo ...
- 前端知识体系:JavaScript基础-原型和原型链-instanceof的底层实现原理
instanceof的底层实现原理(参考文档) instanceof的实现实际上是调用JS的内部函数 [[HasInstance]] 来实现的,其实现原理是:只要右边变量的prototype在左边变量 ...
- 题解 [CF525D] Arthur and Walls
题面 解析 首先考虑将一个\('*'\)变成\('.'\)后会形成什么, 显然至少是一个\(2\times 2\)的矩形. 因为\(1\times 1\)和\(1\times 2\)的改了没用啊, 而 ...
- 在当前目录下配置ansible
配置ansible.cfg [defaults] inventory = myhost # 指定主机清单文件 host_key_checking = False 配置主机清单文件 [node] nod ...
- learning rewind func
函数名: rewind() 功 能: 将文件内部的位置指针重新指向一个流(数据流/文件)的开头 注意:不是文件指针而是文件内部的位置指针,随着对文件的读写文件的位置指针(指向当前读写字节)向后移动.而 ...
- 【线性代数】3-4:方程组的完整解( $Ax=b$ )
title: [线性代数]3-4:方程组的完整解( Ax=bAx=bAx=b ) categories: Mathematic Linear Algebra keywords: Ax=b Specia ...
- 日期与时间(C/C++)
C++继承了C语言用于日期和时间操作的结构和函数,使用之前程序要引用<ctime>头文件 有四个与时间相关的类型:clock_t.time_t.size_t.和tm.类型clock_t.s ...
- Python数据抓取(2) —简单网络爬虫的撰写
(一)使用Requests存储网页 Requests 是什么?网络资源(URLs)抓取套件 优点? 改善urllib2的缺点,让使用者以最简单的方式获取网络资源 可以使用REST操作(POST,PUT ...
- Jquery 2.0+版本不支持IE8,如何解决?
用了JQuery2.0+以后,在IE8下会报错,下面是我的方法. 先看代码: <!--[if !IE]> --> <script src="/Scrip ...
- 2 - Rich feature hierarchies for accurate object detection and semantic segmentation(阅读翻译)
Rich feature hierarchies for accurate object detection and semantic segmentation Ross Girshick Jeff ...