局域网无法连接redis端口

telnet不通redis端口 连接不上redis服务怎么办?telnet不通redis端口,本机的客户端可以使用redis-cli -h 127.0.0.1 -p 6379连接,但是redis-cli -h ip -p 6379无法连接,远程客户端也无法连接。

redis.conf属性:

1.bind

#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.

bind并非配置的是远程客户端的ip,而是本机的ip.

在配置文件redis.conf中,默认的bind 接口是127.0.0.1。

这样的话,访问redis服务只能通过本机的客户端连接,而无法通过远程连接,

如果bind选项为空的话,那会接受所有来自于可用网络接口的连接。

bind 127.0.0.1 192.168.1.202(本机ip),就可以远程连接了

2.requirepass

如果注释掉bind,可以通过配置密码来验证.

注意:如果注释掉bind,而且不配置密码,第三方jar包Jedis无法连接.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值