Home > Web Front-end > CSS Tutorial > Redis3.2 detailed steps to enable remote access

Redis3.2 detailed steps to enable remote access

赶牛上岸
Release: 2018-03-06 16:41:18
Original
2109 people have browsed it

Redis is an open source log-type Key-Value database written in ANSI C language, supports network, can be memory-based and persistent, and provides APIs in multiple languages. Redis supports remote access. The editor has compiled the detailed steps for you. The specific steps are as follows:

Redis only allows local access by default. To enable remote access to redis, you can modify redis.conf
Open redis. The conf file has instructions 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 server.
# 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 ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1
Copy after login

To enable redis to be accessed remotely, just comment out bind 127.0.0.1 in the redis.conf configuration file to enable all IP access to redis

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

Note

After redis3.2, redis Added protected-mode. In this mode, even if bind 127.0.0.1 is commented out, an error will still be reported when accessing redisd. The solution is as follows

(error) 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.
Copy after login

Modify the original protected-mode yes to protected-mode no

Save the configuration file and restart redis.

Related recommendations:

Explanation of PHP operation Redis examples

A simple example sharing of php+redis

Detailed explanation of redis and the use of Redis in the ThinkPhP5 framework

The above is the detailed content of Redis3.2 detailed steps to enable remote access. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template