Redis only supports local use by default. How to enable remote connection and remotely access the remote redis server?
General steps to open a remote connection:
1. Shield local binding information
2. Add requirepass
3. Restart redis
4. Add the redis port to the firewall rules
Next look at the detailed process
Comment redis binding
Modify the redis configuration file
vi /usr/local/redis/etc/redis.conf
Search bind 127.0.0.1 Comment out all
Set requirepass
requirepass field is actually the auth password for the redis connection
Set as shown in the picture
Restart reids
service redis-server restart
Add firewall rules
iptables -I INPUT -p tcp -m state –state NEW -m tcp –dport 6379-j ACCEPT
Here you can connect to redis remotely
For more redis knowledge, please pay attention to the PHP Chinese websiteredis tutorial column.
The above is the detailed content of How to configure remote connection in redis. For more information, please follow other related articles on the PHP Chinese website!