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無法連接.