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" ...
随机推荐
- 【BZOJ2698】染色
题解: 首先比较显然的是查询每个点被覆盖的概率,算完之后概率m次方 既然是计数题 考虑容斥 我们会发现这样是求n长度的区间能存多少种 我们考虑直接递推 从n到n+1 多的方案数一定要覆盖n+1,所以就 ...
- [转]java位运算(1)
http://blog.csdn.net/xiaochunyong/article/details/7748713 Java提供的位运算符有:左移( << ).右移( >> ) ...
- linux 锁定重要文件 更改重要命令
锁定重要文件如下: chattr +i /etc/passwd /etc/shadow /etc/groupp /etc/gshadow 解锁文件 chattr -i /etc/passwd /etc ...
- python全栈开发day51-jquery插件、@media媒体查询、移动端单位、Bootstrap框架
一.昨日内容回顾 技术行业 (1)ajax技术 XMLHttpRequest() <1>创建XMLHttpRequest()对象 <2>检测状态(通过readyState的改变 ...
- springmvc+ajax——第三讲(post请求)
在ajax01.html中增加个input标签: 在ajax的js中增加: 在controller中仍然使用getParamter():
- nssm部署.net core console到windows服务
轻便式发布 与.net fx不同 需要dotnet.exe来引导 Path:默认为 C:\Program Files\dotnet\dotnet.exe: Startup directory:程序所在 ...
- OpenJ_Bailian 4017 爬楼梯
时间限制: 1000 ms 空间限制: 262144 KB 题目描述 树老师爬楼梯,他可以每次走1级或者2级,输入楼梯的级数,求不同的走法数.例如:楼梯一共有3级,他可以每次都走一级,或者第一次走一 ...
- Java 之 Web前端(六)
1.AJAX a.定义:异步的 JS 和 XML b.作用:不重新加载页面的情况下,与服务器的数据进行交互,改变网页的部分内容 c.语法: <html> <head> < ...
- JAVA基础中的注意点(一)
1.标识符 标识符:标识某些事物用于区分的符号. (即区分某些事物的符号) 四条硬性规定: a.不能是 关键字.true.false.null. b.可以包含 字母.数字(0-9).下划线(_)或美 ...
- HDU 1054 Strategic Game (最小点覆盖)【二分图匹配】
<题目链接> 题目大意:鲍勃喜欢玩电脑游戏,特别是战略游戏,但有时他无法找到解决方案,速度不够快,那么他很伤心.现在,他有以下的问题.他必须捍卫一个中世纪的城市,形成了树的道路.他把战士的 ...