Redis3.2 turning on remote access detailed steps

Source: Internet
Author: User
Redis is an open source API that is written in ANSI C, supports the web, can be persisted in memory, key-value databases, and provides multiple languages. Redis support remote access, detailed steps of the small series has been compiled for everyone, the steps are as follows:

Redis only allows local access by default, so Redis can be accessed remotely to modify redis.conf
Opening the redis.conf file is described in the network section

################################## NETWORK ###################################### By default, if no "bind" Configuration directive is specified, Redis listens# for connections from all the network interfaces available on the Serv er.# It is possible to listen to just one or multiple selected interfaces using # the "Bind" configuration directive  , followed by one or more IP addresses.## examples:## bind 192.168.1.100 10.0.0.1# bind 127.0.0.1:: 1## ~ ~ ~ WARNING ~ ~ ~ The computer running Redis is directly exposed to the# Internet, binding to all the interfaces are dangerous and would expo Se the# instance to everybody on the internet. So by default we uncomment the# following bind directive, that would force Redis to listen only into# the IPv4 lookback int Erface address (This means Redis would be able to# accept connections only from clients running into the same computer it# is running). # # IF You were sure you want YOUR INSTANCE to LISTEN to all the interfaces# JUST COMMENT the followingline.# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~bind 127.0.0.1 

Make Redis remotely accessible as long as you comment out bind 127.0.0.1 in the redis.conf configuration file, you can make all IP access to Redis

If you want to specify multiple IP access, but not all IP access, you can bind multiple IPs

Attention

After redis3.2, Redis added Protected-mode, in this mode, even if the comment off the bind 127.0.0.1, and then access REDISD time or error, as follows

(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-adopt one of the following solutions:1) Just disable prot ected 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 are not publicly accessible from Internet if your 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 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 workaround is to modify the original Protected-mode Yes to Protected-mode no

Save the configuration file and restart Redis.

Related recommendations:

PHP Operation Redis Example explained

A simple example of php+redis sharing

Use of Redis and Redis in the THINKPHP5 framework

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.