小编kac*_*ow6的帖子

从docker容器连接到本地redis集群时ioredis连接不断重置

我有一个 docker compose 容器化客户端/服务器节点应用程序,无法创建与我在本地环境中运行的 redis 集群的稳定连接。Redis 集群有 6 个节点(3 个主节点,3 个副本配置)在我的本地计算机上运行。每次我启动应用程序并尝试连接到 Redis 时,该connect事件都会被发送垃圾邮件,并且我的客户端上会收到以下错误:

Proxy error: Could not proxy request /check-login from localhost:3000 to http://server.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET)
Run Code Online (Sandbox Code Playgroud)

我已确保将Redis集群配置为protected-mode允许no远程访问集群。我已确认可以通过 ping 集群节点之一来本地访问集群:bind0.0.0.0redis-cli -h 127.0.0.1 -p 30001

127.0.0.1:30001> ping
PONG
127.0.0.1:30001> exit
Run Code Online (Sandbox Code Playgroud)

我将我的REDIS_HOSTS环境设置为"host.docker.internal:30001,host.docker.internal:30005,host.docker.internal:30006". 这应该允许我连接到在127.0.0.1我的主机上运行的 redis 集群。我的节点应用程序代码:

const Redis = require("ioredis");

const hosts = process.env.REDIS_HOSTS.split(",").map((connection) => {
  const [host, port] = connection.split(":");

  return {
    host,
    port, …
Run Code Online (Sandbox Code Playgroud)

networking redis node.js docker-compose ioredis

7
推荐指数
1
解决办法
8325
查看次数

create-react-app/express Proxy error: Could not proxy request (ECONNRESET)

I have created a react app using create-react-app and an express server using express-generator. My react app is running on http://localhost:3000 and my express server is running on http://localhost:8080. In my component I am making a POST fetch request to my express server, which is successfully running my express router code, returning a 200 response status code. However, the client console logs the following error and does not receive the response:

Proxy error: Could not proxy request /components/findAlbumArt from …
Run Code Online (Sandbox Code Playgroud)

node.js express reactjs fetch-api create-react-app

2
推荐指数
1
解决办法
3010
查看次数

无法从 EC2 中运行的 docker 容器连接到 elasticache redis

作为我的 CI 过程的一部分,我正在创建一个 docker-machine EC2 实例并通过 docker-compose 在其中运行 2 个 docker 容器。服务器容器测试脚本尝试连接到与 EC2 位于同一 VPC 中的 AWS elasticache redis 实例。运行测试脚本时,出现以下错误:

1) Storage
       check cache connection
         should return seeded value in redis:
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/usr/src/app/test/scripts/test.js)
      at listOnTimeout (internal/timers.js:549:17)
      at processTimers (internal/timers.js:492:7)
Run Code Online (Sandbox Code Playgroud)

更新:我可以通过 EC2 本身的 redis-cli 进行连接:

redis-cli -c -h ***.cache.amazonaws.com -p 6379 ping
> PONG
Run Code Online (Sandbox Code Playgroud)

看起来我无法连接到我的 redis 实例,因为我的 docker 容器使用的 IP …

amazon-web-services redis amazon-elasticache docker docker-compose

1
推荐指数
1
解决办法
2005
查看次数