As shown below, the program reports an error when connecting to redis. According to the error information, redis is running in protected mode. It needs to be set under the redis command line: config set protected-mode no.
-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: 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. 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. If you started the server manually just for testing, restart it with the ‘–protected-mode no’ option. 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.
Error message when using pycharm to connect to redis:
Detect redis port 6379 through telnet command
Solution:
Set protected-mode no
Check the redis port 6379 through the telnet command again, and there is no access exception.
Run Python again to connect to redis:
Supplementary knowledge:
When you use telnet (telnet IP port number) to connect to the host under Linux/Unix, you will be prompted “escape character is’ ^] ‘. What does this mean? How to solve it?
Escape character is ‘^]’. Solution
“^” means the Ctrl key!
1. This prompt means that pressing Ctrl +] will call out the command line of Telnet!
2. After the telnet command line comes out, you can execute the telnet command;
3. Exit the telnet command line with the name quit.
Common telnet commands
close closes the current connection
logout forces the remote user to exit and close the connection
display displays the parameters of the current operation
mode attempted to enter command line mode or character mode
open connect to a site
quit exit
telnetsend send special characters
set sets the parameters of the current operation
unset resets the current operating parameters
status print status information
toggle switch operation parameters
slc changes the state of special characters
Auth on/off confirmation function Z suspended
Telnetenviron changes the environment variable and displays help
To sum up, escape character is’ ^] ‘. It is just a prompt that you can call the command line of Telnet using Ctrl +] key.
Read More:
- [Solved] Redis Error: org.springframework.data.redis.RedisConnectionFailureExceptionjava.net.SocketTimeoutException
- [Solved] java.lang.IllegalAccessError: class org.springframework.data.redis.core.$ Proxy237 cannot access its superinterface org.springframework.data.redis.core.RedisConnectionUtils$RedisConnectionProxy
- Error in make when installing redis6.0 in centos7
- [Solved] Redis Client On Error: Error: write ECONNABORTED Config right
- [Solved] Consider defining a bean of type ‘org.springframework.data.redis.core.RedisTemplate‘ in your configu
- Defining a bean of type ‘org.springframework.data.redis.core.RedisTemplate‘ in your configuration.
- [Solved] Redis error: NOAUTH Authentication required.
- Springboot startup error: err config is disabled command (Redis Disables Config command)
- Failed to restart redis-server.service Unit not found [How to Solve]
- [Solved] Jedis connect and operate Redis error: Failed to create socket和connect timed out
- [Solved] Windows Redis Error: Could not create server TCP listening socket 127.0.0.1:6379: bind…
- [Solved] Redis Error: Unexpected exception while processing command
- Redis Stand-alone Builds a Master-slave Copy Error [How to Solve]
- Redis Startup Error: Creating Server TCP listening socket 127.0.0.1:6379: bind: No error
- Redis: How to Implementate LRU Caching Mechanism Manually
- [Solved] Windows redis startup error: Error code: [35256]…
- [Solved] Springboot uses redis to add LocaldateTime Java 8 error
- [Solved] Redis Client On Error Error connect ECONNREFUSED 11.20.200.6379 Config right
- JAVA Connect Redis Error: stop-writes-on-bgsave-error option
- [Solved] redis-server.exe Flashback Error: QForkMasterInit: system error caught. error code=0x000005af, message=Virtual