现在网上一查出现安全模式的连接,基本都是要关闭服务端的操作,其实这种方式是不正确的,最有效的解决方式是使用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://docs.azure.cn/zh-cn/articles/azure-operations-guide/redis-cache/aog-redis-cache-using-redis-cli-connect-azure-redis-cache

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的安全模式的更多相关文章

  1. ab测试出现error: connection reset by peer的解决方案

    我们在使用一些开源程序之前,可能会使用ab工具在服务器或者本地进行一次性能评估,但是很多时候却总是会以失败告终,因为,服务器会拒绝你的ab工具发出的http请求, 出现 error: connecti ...

  2. rsync: read error: Connection reset by peer (104)

    Centos7    rsync守护进程上传文件失败 [root@nfs ~]# rsync -avz /etc rsync_backup@172.16.1.41::backupsending inc ...

  3. fatal: read error: Connection reset by peer解决办法

    标签(空格分隔): ceph源码安装,git 问题描述: 源码安装ceph,克隆代码时提示如下错误: [root@localhost ~]# git clone git://github.com/ce ...

  4. error connection reset by peer 104

    connection reset by peer的常见原因 1.服务器的并发连接数超过了其承载量,服务器会将其中一些连接关闭:2. errno = 104错误表明你在对一个对端socket已经关闭的的 ...

  5. 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 ...

  6. 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: ...

  7. 【Azure Redis 缓存】 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connection reset by peer"

    问题描述 Python连接Azure Redis, 使用redis.ConnectionPool 出现 "ConnectionResetError: [Errno 104] Connecti ...

  8. jmeter测试文件上传接口报错:connection reset by peer: socket write error

    最近在对文件上传接口性能测试时,设置150线程数并发时,总会出现以下错误:connection reset by peer: socket write error 在网上搜索了一下,得到的原因有这些: ...

  9. Error -27780: Connection reset by peer: socket write error

    Problem Description: Error: "-27780: read to host failed: [10054] Connection reset by peer" ...

随机推荐

  1. bzoj4059

    题解: 还是一道不错的题目 首先它要求每个区间都满足要求,所以我们很容易想到将它映射到二维平面上 然后我们算出每个数的前驱以及后继li,ri 那么第一维是li-i,第二维是i-ri的区间就是合法的,同 ...

  2. JMeter中BeanShell的实际应用

    使用Jmeter的BeanShell断言,把响应数据中的JSON跟数据库中的记录对比 很多时候我们需要把Response Data取到的 Json 字符串跟数据库里的对比,来验证接口的正确性,使用Be ...

  3. java定时任务以及Spring使用Quartz调度器执行定时任务

    java下的java.util.Timer中类可以实现定时执行任务的执行: 如:让任务立即执行,每隔1s循环执行一次 public class TimerClass { public static v ...

  4. ASP.NET MVC 路由篇二

    轉載 http://www.cnblogs.com/yaozhenfa/p/asp_net_mvc_route_2.html 7.解决与物理路径的冲突 当发送一个请求至ASP.NET MVC时,其实会 ...

  5. 整合django和bootstrap框架

    环境: python版本:2.7.8 django版本:1.7.1 bootstrap版本:3.3.0 首先github上面有两个开源的项目用来整合django和bootstrap. https:// ...

  6. LIS+二分法

    http://poj.org/problem?id=3903 数列里是存从小到大排的数,二分也是为了这个服务的,不断更新.而len才是所求长度 #include <iostream> #i ...

  7. Tallest Cow POJ - 3263 (区间点修改)

    FJ's N (1 ≤ N ≤ 10,000) cows conveniently indexed 1..N are standing in a line. Each cow has a positi ...

  8. POJ 3275 Ranking the Cows(传递闭包)【bitset优化Floyd】+【领接表优化Floyd】

    <题目链接> 题目大意:FJ想按照奶牛产奶的能力给她们排序.现在已知有N头奶牛$(1 ≤ N ≤ 1,000)$.FJ通过比较,已经知道了M$1 ≤ M ≤ 10,000$对相对关系.每一 ...

  9. Codeforces 919D Substring 【拓扑排序】+【DP】

    <题目链接> 题目大意:有一个具有n个节点,m条边的有向图,每个点对应一个小写字母,现在给出每个顶点对应的字母以及有向边的连接情况,求经过的某一条路上相同字母出现的最多次数.如果次数无限大 ...

  10. POJ_2376_Cleaning Shifts【贪心】【区间覆盖】

    题目链接 题目大意: 有一些奶牛,每只奶牛负责一个时间段.问覆盖完全部的时间段最少需要多少只奶牛.若不能全部覆盖,输出-1. #include <cstdio>#include <a ...