专注于 JetBrains IDEA 全家桶,永久激活,教程
提供 JetBrains 全家桶激活码、注册码、破解补丁下载及详细激活教程,等工具的永久激活

客户端无法登录Redis服务器报错,解除保护模式

以下是Java代码:

import redis.clients.jedis.Jedis;
/**
 * @author Hiseico
 * @create 2018-05-15 17:00
 * @desc
 **/
public class RedisDao {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("192.168.169.115");
        jedis.lpush("JavaList","bbb","ccc","ddd");
        jedis.close();
    }
}

在执行Java操作redis的代码的时候抛出异常:

-DENIED Redis is running in protected modebecause protected mode is enabled, no bind address was specified, noauthentication password is requested to clients.   
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   
solutions: 1) Justdisable protected mode sending the command 'CONFIG SET protected-mode no' fromthe loopback interface by connecting to Redis from the same host   
the server isrunning, however MAKE SURE Redis is not publicly accessible from internet ifyou do so. Use CONFIG REWRITE to make this change permanent.   
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.   
3) If you started the server manually just for testing, restart it withthe '--protected-mode no' option.   
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.  
Connection closed by foreign host.  

解决方案:

1、修改redis服务器的配置文件

vi redis.conf

注释以下绑定的主机地址

# bind 127.0.0.1

2、修改redis服务器的参数配置

修改redis的守护进程为no ,不启用 127.0.0.1:6379> config set daemonize "no"

修改redis的保护模式为no,不启用 127.0.0.1:6379> config set protected-mode "no"

文章永久链接:https://tech.souyunku.com/47461

未经允许不得转载:搜云库技术团队 » 客户端无法登录Redis服务器报错,解除保护模式

JetBrains 全家桶,激活、破解、教程

提供 JetBrains 全家桶激活码、注册码、破解补丁下载及详细激活教程,支持 IntelliJ IDEA、PyCharm、WebStorm 等工具的永久激活。无论是破解教程,还是最新激活码,均可免费获得,帮助开发者解决常见激活问题,确保轻松破解并快速使用 JetBrains 软件。获取免费的破解补丁和激活码,快速解决激活难题,全面覆盖 2024/2025 版本!

联系我们联系我们