linux - 无法从 Windows 连接到 Redis Linux 服务器

标签 linux windows ubuntu redis

我无法从 Windows 8.1 64 位连接到 Redis 服务器(ubuntu 服务器 16.04 LTS 64 位在单独的 PC 上)。 Redis 有很好的文档记录,但是我发现很少有关于如何从单独的机器连接 Redis 服务器的信息。 我已经将最新版本的 redis 安装到 linux 中,并且在本地一切正常。我通过 redis-server 启动服务器,同时启动 redis-cli 之后,我可以将信息添加到服务器并检索它。同样的情况出现在 Windows 中——一切都在本地工作。 为了从 Windows 连接到 Linux Redis 服务器,我做了这些更改。 在 linux 中,我通过 sudo nano/etc/network/interfaces 设置静态本地 IP

地址 192.186.xxx.xxx

网络掩码 255.255.255.0

网络 192.168.xxx.xxx

广播 192.168.xxx.xxx

网关 192.168.xxx.xxx

DNS 域名服务器 8.8.8.8

redis.conf 文件中,我绑定(bind)了我的 Internet 服务提供商提供的 Windows PC IP。我还在我的路由器 GUI 中打开了 TCP 6379 端口。在 Windows 中,我修改了 redis.windows-service.confredis.windows.conf 文件。在他们两个中,我都绑定(bind)了我的互联网服务提供商提供的 IP 地址。在此之后我无法正常启动 redis-cli (可以看到空的黑色 cmd 窗口) 我做错了什么?如果有任何帮助,我将不胜感激。

最佳答案

你应该修改redis conf,我的redis conf位于/etc/redis/6379.conf。

并且您应该注释行“绑定(bind) 127.0.0.1”或更改为绑定(bind) 0.0.0.0。 bind 指定 redis 服务器应该监听哪个网络接口(interface)。默认为本地主机。

并且还将保护模式更改为无:

Protected mode is a layer of security protection, in order to avoid that Redis instances left open on the internet are accessed and exploited.

When protected mode is on and if:

1) The server is not binding explicitly to a set of addresses using the "bind" directive.

2) No password is configured.

The server only accepts connections from clients connecting from the IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain sockets.

By default protected mode is enabled. You should disable it only if you are sure you want clients from other hosts to connect to Redis even if no authentication is configured, nor a specific set of interfaces are explicitly listed using the "bind" directive.

protected-mode yes

如果你不禁用保护模式,你的redis服务器将不会监听公共(public)ip接口(interface)。更多细节见上文。

关于linux - 无法从 Windows 连接到 Redis Linux 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45429993/

相关文章:

Windows 路径上的 PHP 出现反斜杠

c++ - 如何释放指针数组指向的结构的内存?

java - 找到每个本地 Eclipse 工作区

apache - 如何限制用户访问目录而不是其中的文件

javascript - Cronjob 停止执行 nodejs

c++ - 是否有类似于 NUnit 的 C++ 单元测试库?

linux - 如何从 Linux 和 Solaris 上的挂载中提取 NFS 信息?

windows - 'flutter' 命令在项目的根目录中不起作用。 [ Windows ]

Apache + WSGI : Address already in use: make_sock: could not bind to address

linux - 在编辑器中打开一个文件,然后通过终端在 bash 上将其保存回来