1.1 连接不上redis服务

来源:互联网 发布:js div click事件 编辑:程序博客网 时间:2024/06/05 06:53

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

原创粉丝点击