redis 关闭保护模式

1.错误代码没有贴,如果出现记得添加gcc包

《redis 关闭保护模式》 image.png

2.如果发现命令行中只能打印出大写在符号,那么长安【A】就好,或者shift+[A]试试

3.mini安装Linux发现连不了网,要在配置文件中启动网关,并且设置自动分配IP地址,如果手动配置IP地址的话开门,可能还是连不上

4.java连接Redis出现错误,

——–(错误原因:1>Linux防火墙默认是开启的 2>Redis默认是保护模式(绑定到127.0.0.1))

—–如下是错误类型:

《redis 关闭保护模式》 image.png
《redis 关闭保护模式》 image.png

《redis 关闭保护模式》 image.png

解决方法:

关闭防火墙同时关闭Redis的保护模式

《redis 关闭保护模式》 image.png

解除绑定:

《redis 关闭保护模式》 image.png
《redis 关闭保护模式》 image.png
《redis 关闭保护模式》 image.png

解除绑定:

《redis 关闭保护模式》 image.png

解除保护模式:

《redis 关闭保护模式》 image.png

其实也可以按照java的报错信息来修改:

DENIED Redis is running in protected mode 
because protected mode is enabled, no bind address was specified, 
no authentication password is requested to clients. 
In this mode connections are only accepted from the loopback interface. 
If you want to connect from external computers to Redis you may adopt one of the following solutions: 
    1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, 
        however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 
    2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 
    3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 
    4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

翻译成中文:

DENIED Redis运行在保护模式,
因为启用了保护模式,没有指定绑定地址,没有向客户端请求认证密码。
在这种模式下,连接只能从回送接口接受。如果要从外部计算机连接到Redis,您可以采用以下解决方案之一:
1)只需禁用保护模式,即可通过从同一主机连接到Redis,从回送接口发送命令“CONFIG SET protected-mode no”正在运行,
   但是如果您这样做,请勿使用互联网公开访问互联网。使用CONFIG REWRITE使此更改永久。
2)或者,您可以通过编辑Redis配置文件并将保护模式选项设置为“no”来禁用保护模式,然后重新启动服务器。
3)如果您只是为了测试而手动启动服务器,请使用“ - 保护模式否”选项重新启动服务器。4)设置绑定地址或认证密码。注:您只需要执行上述操作之一,以便服务器开始接受来自外部的连接。

所以连接Redis执行:
CONFIG SET protected-mode no
CONFIG REWRITE

Redis的服务的关闭方式

《redis 关闭保护模式》 image.png

查看是否有Redis进程

—————-$ps -ef|grep redis

《redis 关闭保护模式》 image.png

    原文作者:周紫一
    原文地址: https://www.jianshu.com/p/5f96b56ec921
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞