局域网无法连接redis端口

水深无声 2022-05-27 05:25 333阅读 0赞

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无法连接.

发表评论

表情:
评论列表 (有 0 条评论,333人围观)

还没有评论,来说两句吧...

相关阅读

    相关 连接局域网MySql

    连接局域网MySql 今天遇见一个小问题,记录一下。 描述:不同的主机连接局域网内某台主机的MySql数据库。 防火墙设置 因为安全的问题,不能直接关闭防火墙,