今天使用RedisDesktopManager客戶端連接遠程連接redis的時候,一直連不上.原來是redis默認只能localhost登錄,所以需要開啟遠程登錄。解決方法如下:
在redis的配置文件redis.conf中,找到bind localhost注釋掉。
注釋掉本機,局域網內的所有計算機都能訪問。
band localhost 只能本機訪問,局域網內計算機不能訪問。
bind 局域網IP 只能局域網內IP的機器訪問, 本地localhost都無法訪問。
注意事項:
今天再設置遠程訪問的時候,在啟動Redis的時候報錯:Creating Server TCP listening socket *:6379: unable to bind socket(Redis一定不能設置成后台運行,否則終端不會有任何錯誤顯示)。
上網搜索說各種原因的都有,有的說是Redis版本的bug(我用的版本是3.2.8),我是參考以下幾篇文章解決了這個問題:
https://github.com/antirez/redis/issues/3241
http://blog.csdn.net/qq_25797077/article/details/51986455
http://stackoverflow.com/questions/8537254/redis-connect-to-remote-server
http://www.cnblogs.com/machanghai/p/5497084.html
我沒有注釋掉bind 127.0.0.1,而是將bind 127.0.0.1 改成了bind 0.0.0.0。