Redis开启远程登录连接

今天使用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。

原文地址:https://www.cnblogs.com/dangzhenjiuhao/p/6737289.html