Connect remote redis

There are mainly two steps are required to modify configuration files redis.conf

The first step: Modify bind address redis.conf. The default is #bind 127.0.0.1, is the only local login, we can change it to bind 0.0.0.0 (note to remove the # sign in front)

# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# 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
bind 0.0.0.0

Step two: add a password, if you do not add a password, then, redis is the default protection mode, that is, only log on a local virtual machine, so we need to add a password
to modify requirepass configuration items redis.conf in the modification # requirepass foobared to requirepass root (password into your own settings, but also need to remove the comment before the # sign)

# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
requirepass root

At this point you can use Redis Desktop Manager to connect, and I was in win7 above redis connection on ubuntu, you can first test could not connect on port 6379 on the remote virtual machine, open cmd window, use

telnet 192.168.1.244 6379 (need to modify to their own ip) command to test, if "" telnet is not an internal or external command "Display", need to open a telnet client (default is off), after a successful test can be connected


Note: open redis 6379 port

Pagoda -> 6379 port security release

/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT

Restart redis

发布了6 篇原创文章 · 获赞 0 · 访问量 1万+

Guess you like

Origin blog.csdn.net/manbudezhu/article/details/89153642