局域网无法连接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无法连接.
还没有评论,来说两句吧...