Python Remote connection Redis

Source: Internet
Author: User
Tags configuration settings

Import Redis
R=redis. Redis (host= ' 192.168.56.102 ', port=6379,db=0,password= ' Jinxfredis ')
R.set (' name ', ' Jin ')
Print (R.get (' name '))

Python remote connection Redis times the following error:

DENIED Redis is running in protected mode because protected mode are enabled, no bind address was specified, no authenticat Ion password is requested to clients. The This mode connections is only accepted from the loopback interface.

If you want to connect from external computers to Redis one of the following solutions:

1) Just disable protected mode sending the command ' CONFIG SET protected-mode No ' from the loopback interface by Connectin G to Redis from the same host the server was running, however make sure Redis are not publicly accessible from Internet if y ou do. 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 PROTECTE d 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 does one of the above things in order for the server to start accepting connections from the outside.

The rejected Redis runs in protected mode because the protected mode is enabled, no binding address is specified, and no authentication password is requested from the client. in this mode, the connection can only be accepted from the loopback interface. If you want to connect to a retelling from an external computer, you may be able to take a solution:

1) Just disable protected mode Send command configuration settings protection mode does not connect from loopback interface to retelling the same host server is running, however make sure to retell, not publicly accessible from the Internet if you do. use configuration overrides to make this change permanent.

2) You can also disable protected mode by editing the Redis configuration file, setting the protected mode option to No, and then restarting the server.

3) If you are simply starting the server manually for testing purposes, restart the server using the "-Protected mode no" option.

4) set the binding address or authentication password. Note: In order for the server to start accepting connections from outside, you only need to do one of the above.

Following the above 2-4 settings,

Bind 0.0.0.0

Protected-mode No

Requirepass Password

new Redis, still reported the same error ...

The original Redis does not specify a configuration file, the default settings start, so when you restart Redis, set the specified configuration file, remote access to the normal

Python Remote connection Redis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.