1. set key出现的报错

  1. 192.168.56.57客户端登录192.168.56.56redis服务器时,报错如下:
  2. [root@localhost src]# ./redis-cli -h 192.168.56.56 -p 6379 -a "aabbcc"
  3. 192.168.56.56:6379> ping
  4. Error: Connection reset by peer
  5.  
  6. telnet一下192.168.56.56redis服务器的6379端口,提示redis服务有保护模式,需要解除
  7. [root@localhost src]# telnet 192.168.56.56 6379
  8. Trying 192.168.56.56...
  9. Connected to 192.168.56.56.
  10. Escape character is '^]'.
  11.  
  12. -DENIED Redis is running in protected modebecause protected mode is enabled, no bind address was specified, noauthentication password is requested to clients.
  13. In this mode connections areonly accepted from the loopback interface. If you want to connect from externalcomputers to Redis you may adopt one of the following
  14. solutions: 1) Justdisable protected mode sending the command 'CONFIG SET protected-mode no' fromthe loopback interface by connecting to Redis from the same host
  15. the server isrunning, however MAKE SURE Redis is not publicly accessible from internet ifyou do so. Use CONFIG REWRITE to make this change permanent.
  16. 2) Alternativelyyou can just disable the protected mode by editing the Redis configurationfile, and setting the protected mode option to 'no', and then restarting theserver.
  17. 3) If you started the server manually just for testing, restart it withthe '--protected-mode no' option.
  18. 4) Setup a bind address or an authenticationpassword. NOTE: You only need to do one of the above things in order for theserver to start accepting connections from the outside.
  19. Connection closed by foreign host.

2. 原因是redis的保护模式

默认redis需要设置管理员账号密码,开启了保护模式

所以如果第一次使用没有设置管理员,就会出现报错,关闭保护模式即可

3. 解决方法

方法一:

  1. 修改redis的守护进程为no ,不启用
  2. 127.0.0.1:6379> config set daemonize "no"
  3. OK
  4.  
  5. 修改redis的保护模式为no,不启用
  6. 127.0.0.1:6379> config set protected-mode "no"
  7. OK

方法二:推荐

修改配置文件

  1. 1) 绑定IP地址,看业务开放
  2. bind 0.0.0.0
  3.  
  4. 2)Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程,设置为no
  5.  
  6. daemonize no
  7.  
  8. 3)保护模式
  9.  
  10. protected-mode no

3. 启动加载配置文件

  1. /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis6379.conf
  2. # 检查启动状态命令
  3. ps -ef|grep redis |grep 6379

redis关闭保护模式的更多相关文章

  1. Windows Redis 取消保护模式C#进行访问

    运行redis服务程序和客户端程序设置即可. config set protected-mode “no”

  2. Redis 保护模式

    默认 redis 启用了保护模式,即如果是远程链接不能进行 CRUD 等操作,如果进行该操作报错如下 (error) DENIED Redis is running in protected mode ...

  3. centos7下的redis集群模式

    1.先安装好单机版的redis 2.Reids安装包里有个集群工具,要复制到/usr/local/bin里去 cd /home/redis/redis-4.0./src ls - cp redis-t ...

  4. Redis 5 配置 Redis sentinel(哨兵模式)

    先了解一下哨兵都 做了什么工作:Redis 的 Sentinel 系统用于管理多个 Redis 服务器(instance), 该系统执行以下三个任务: * 监控(Monitoring): Sentin ...

  5. Linux虚拟机系统中进行redis的哨兵模式配置

    一.配置步骤 开一台虚拟机1.创建三个redis配置文件:/etc/redis下pidfile "/var/run/redis6380.pid" redis的id号port 638 ...

  6. Redis三种模式——主从复制,哨兵模式,集群

    一.Redis主从复制作用 数据冗余:主从复制实现了数据的热备份,是持久化之外的一种数据冗余方式. 故障恢复:当主节点出现问题时,可以由从节点提供服务,实现快速的故障恢复:实际上是一种服务的冗余. 负 ...

  7. redis之禁用保护模式以及修改监听IP

    今天在安装filebeat的时候,出现了关于redis报错的问题,所以来总结一下: 报错信息是: (error) DENIED Redis is running in protected mode b ...

  8. Redis进阶:Redis的哨兵模式搭建

    Redis进阶:Redis的哨兵模式搭建 哨兵机制介绍 单机版的Redis存在性能瓶颈,Redis通过提高主从复制实现读写分离,提高了了Redis的可用性,另一方便也能实现数据在多个Redis直接的备 ...

  9. 企业IT管理员IE11升级指南【1】—— Internet Explorer 11增强保护模式 (EPM) 介绍

    企业IT管理员IE11升级指南 系列: [1]—— Internet Explorer 11增强保护模式 (EPM) 介绍 [2]—— Internet Explorer 11 对Adobe Flas ...

随机推荐

  1. 关于在VWmare下安装Redhat

    本文是小白博主自行摸索安装的过程,下文主要是给出几篇很有用的文章出处和自己遇到的问题. 一.关于安装包 对于安装包,个人建议是去官网下载(个人安装的是rhel 7.4),可能初接触Linux时,是不是 ...

  2. 手把手教你如何玩转Activiti工作流

    手把手教你如何玩转Activiti工作流 置顶 2018年01月30日 19:51:36 Cs_hnu_scw 阅读数:24023   版权声明:本文为博主原创文章,未经博主允许不得转载. https ...

  3. docker-api

    __author__ = 'zxp' import docker import sys class DockerManager_Slave(object): def __init__(self): s ...

  4. bzoj 2081 [Poi2010]Beads hash+调和级数

    2081: [Poi2010]Beads Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1003  Solved: 334[Submit][Statu ...

  5. [机器学习]-Adaboost提升算法从原理到实践

    1.基本思想: 综合某些专家的判断,往往要比一个专家单独的判断要好.在”强可学习”和”弱可学习”的概念上来说就是我们通过对多个弱可学习的算法进行”组合提升或者说是强化”得到一个性能赶超强可学习算法的算 ...

  6. input file 图片上传展示重新上传

    html <div> <label class="imgMark">说明:</label> <div class="erWeiM ...

  7. 全国排名的问题(linq 的连表查询 等同于sql的left join)

    前言:要获得全国排名,(因为权限问题,显示的数据不是全国的数据,而是某个分区的数据,因此,不能获得数据后排序得到排名) 显示本部的员工积分并且获得在全国的排名. 我的思路:获得显示的员工信息集合1,获 ...

  8. 解决 sun.security.validator.ValidatorException: PKIX path building failed

    今天用java HttpClients写爬虫在访问某Https站点报如下错误: sun.security.validator.ValidatorException: PKIX path buildin ...

  9. [php]http的状态码

    1.分类 100~199 表示成功接受请求,要求客户端继续提交下一次请求才能完成整个过程处理. 200~299 表示成功接收请求并已完成整个处理过程,常用200 300~399 为完成请求,客户需进一 ...

  10. 【leetcode 简单】第十八题 爬楼梯

    假设你正在爬楼梯.需要 n 阶你才能到达楼顶. 每次你可以爬 1 或 2 个台阶.你有多少种不同的方法可以爬到楼顶呢? 注意:给定 n 是一个正整数. 示例 1: 输入: 2 输出: 2 解释: 有两 ...