Redis之远程访问问题-yellowcong

我把redis安装在docker上面后,发现访问不上,后来发现,是redis.conf配置文件的问题,默认情况下,只能本地访问,绑定的是127.0.0.1端口,如果想远程访问,需要两部操作1、注释掉bind 127.0.0.1 ,2、修改protected-mode yesprotected-mode no(这个地方的前提是,我把防火墙关掉了,不考虑防火墙的问题)

1、注释掉bind

如果bind选项为空的话,那会接受所有来自于可用网络接口的连接。
bind 192.168.1.101 表是接收来自192.168.1.101发送过来的请求。

在集群的情况下,必须绑定本机的ip,不然远程连接不上,默认走127.0.0.1

这里写图片描述

2、设定protected-mode


# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
protected-mode no

这里写图片描述

转载于:https://my.oschina.net/u/1987703/blog/1617623

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值