实现redis远程连接

一.修改redis.conf文件

1.把bind 127.0.0.1 -::1这一行注释掉

2.protected-mode 设置成no

3.将daemonize no 修改为 daemonize yes、

4.在# requirepass foobared下面加上requirepass 123456

二.开放端口

1.linux防火墙开放6379(默认)端口

2.如果是云服务器,在云服务器安全组开放端口


如果还不行,可能是启动redis方式不对(本人就是这样)

启动redis时,后面必须跟上redis的配置文件

下面是官方文件注释

1
2
3
4
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf