Redis连接出现Error: Connection reset by peer的问题是由于使用Redis的安全模式
现在网上一查出现安全模式的连接,基本都是要关闭服务端的操作,其实这种方式是不正确的,最有效的解决方式是使用stunnel进行安全模式的连接。
我碰到的问题是微软云(其实我不想用!)连接Redis,默认采用6380做为SSL端口,而微软云同时还会启用非SSL端口6379,如果嫌其麻烦,可以用非SSL进行连接。
下面是解决方法:
1、安装stunnel,这个工具的原理是可以简单的看做代理,把远程请求用stunnel,返回后用本地映射一个端口。
# Mac
brew instsall stunnel
# CentOS
yum install -y stunnel
2、配置
# Mac配置文件路径
vi /usr/local/etc/stunnel/stunnel.conf
# CentOS配置文件路径
vi /etc/stunnel/stunnel.conf
配置如下:
[redis-cli]
client = yes
accept = 127.0.0.1:6380
connect = <Redis 主机名称>:6380

运行stunnel
stunnel
3、连接
注意,此时的连接应该为localhost,而不是上面的地址。
redis-cli.exe -p 6380 –a <访问密钥>
总结:
其实上面可以看出,要先运行stunnel,然后stunnel代理了远程的一个连接,并映射出本地端口,其实本地的端口可以写成别的。
为什么会有stunnel,原因是以前的一些客户端本身不支持SSL,尤其是一些证书等等,那么stuunel很好解决了这一部分客户端的问题,并通过代理使客户端无感知。
参考:
https://www.cnblogs.com/adylee/archive/2007/09/16/894538.html
https://help.compose.com/docs/redis-and-redis-cli
https://aws.amazon.com/cn/premiumsupport/knowledge-center/elasticache-connect-redis-node/
Redis连接出现Error: Connection reset by peer的问题是由于使用Redis的安全模式的更多相关文章
- ab测试出现error: connection reset by peer的解决方案
我们在使用一些开源程序之前,可能会使用ab工具在服务器或者本地进行一次性能评估,但是很多时候却总是会以失败告终,因为,服务器会拒绝你的ab工具发出的http请求, 出现 error: connecti ...
- rsync: read error: Connection reset by peer (104)
Centos7 rsync守护进程上传文件失败 [root@nfs ~]# rsync -avz /etc rsync_backup@172.16.1.41::backupsending inc ...
- fatal: read error: Connection reset by peer解决办法
标签(空格分隔): ceph源码安装,git 问题描述: 源码安装ceph,克隆代码时提示如下错误: [root@localhost ~]# git clone git://github.com/ce ...
- error connection reset by peer 104
connection reset by peer的常见原因 1.服务器的并发连接数超过了其承载量,服务器会将其中一些连接关闭:2. errno = 104错误表明你在对一个对端socket已经关闭的的 ...
- Error: connection reset by peer ,during filebeat connect to elk.
Error screenshot like below: Reason: What I found that was the machine failing had same configuratio ...
- spring+ibatis问题1—— 程序报错:java.sql.SQLException: Io 异常: Connection reset by peer, socket write error; ”或“java.sql.SQLException 关闭的连接”异常
转自:http://blog.sina.com.cn/s/blog_1549fb0710102whz2.html spring+ibatis程序测试时报错:java.sql.SQLException: ...
- 【Azure Redis 缓存】 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connection reset by peer"
问题描述 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connecti ...
- jmeter测试文件上传接口报错:connection reset by peer: socket write error
最近在对文件上传接口性能测试时,设置150线程数并发时,总会出现以下错误:connection reset by peer: socket write error 在网上搜索了一下,得到的原因有这些: ...
- Error -27780: Connection reset by peer: socket write error
Problem Description: Error: "-27780: read to host failed: [10054] Connection reset by peer" ...
随机推荐
- urllib设置debuglevel打开调试开关
1. 参考 Turning on debug output for python 3 urllib https://bugs.python.org/issue26892 Python爬虫入门四之Url ...
- grails2.3.3发布了-【grails】
grails2.3.3发布了,在grails2.3.2中默认方式fork模式下无法运行的BUG也解决了. 需要做的相关修改为修改BuildConfig.groovy: build ':tomcat:7 ...
- yum安装的时候报错,关于python的函数库
我在执行yum -y install nc命令的时候出现如下报错 There was a problem importing one of the Python modulesrequired to ...
- multiprocssing,threading,多进程多线程初识
1. multiprocessing 多进程: import multiprocessing p = multiprocessing.Process(target = func,name = &quo ...
- vim 初识
1. vim + 文件名.py :可以创建并打开vim命令模式 2. 命令模式中:shift + z + z :退出vim 3. 命令模式中(h : 左 , l : 右 , j : 下 , k : ...
- Tomcat v9.0 Could not publish to the server. java.lang.IndexOutOfBoundsException
今天使用Tomcat启动一个java项目,出现报错: Could not publish to the server. java.lang.IndexOutOfBoundsException 众寻之下 ...
- 现代C++之理解模板类型推断(template type deduction)
理解模板类型推断(template type deduction) 我们往往不能理解一个复杂的系统是如何运作的,但是却知道这个系统能够做什么.C++的模板类型推断便是如此,把参数传递到模板函数往往能让 ...
- Springmvc借助SimpleUrlHandlerMapping实现接口开关功能
一.接口开关功能 1.可配置化,依赖配置中心 2.接口访问权限可控 3.springmvc不会扫描到,即不会直接的将接口暴露出去 二.接口开关使用场景 和业务没什么关系,主要方便查询系统中的一些状态信 ...
- provisional headers are shown 知多少
前言 请求里面provisional headers are shown(显示临时报头) 出现的情况很多,但原因是多样的. 如果你去直接匹配关键字搜索,得到的结果可能与你自己的情况大相径庭. 网上大部 ...
- ctf study of jarvisoj reverse
[61dctf] androideasy 164求解器 50 相反 脚本如下: s='' a=113, 123, 118, 112, 108, 94, 99, 72, 38, 68, 72, 87, ...