首页 > 解决方案 > 无法将蜜蜂队列连接到 docker 容器

问题描述

出于某种原因,我似乎很难将蜜蜂队列的竞技场指向我的其他 docker 镜像以获取 redis。只是想知道是否有人对此有任何经验。

这是我正在使用的配置模式

{
  "queues": [
    {
      "hostId": "eyeshade-workers",
      "type": "bee",
      "name": "settlement-report",
      "redis": "redis://redis:3011"
    },
...

我也试过

{
  "queues": [
    {
      "hostId": "eyeshade-workers",
      "type": "bee",
      "name": "settlement-report",
      "redis": {
        "url": "redis://redis:3011"
      }
    },
{
  "queues": [
    {
      "hostId": "eyeshade-workers",
      "type": "bee",
      "name": "settlement-report",
      "url": "redis://redis:3011"
    },

这是我的 redis 和 arena docker-compose 文件在这里:

version: "2.1"

networks:
  ledger:
    driver: bridge

services:
  redis:
    container_name: ledger-redis
    image: redis:latest
    ports:
      - "3011:6379"
    networks:
      - ledger
  arena:
    container_name: worker-arena
    image: mixmaxhq/arena:latest
    networks:
      - ledger
    ports:
      - "4567:4567"
    depends_on:
      - redis
      - eyeshade-worker
    volumes:
      - ./queue/index.json:/opt/arena/src/server/config/index.json

但我不断收到这个错误,说它正在尝试连接到默认值:/

worker-arena         | (node:42) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
worker-arena         | (node:42) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
worker-arena         | (node:42) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
worker-arena         | events.js:182
worker-arena         |       throw er; // Unhandled 'error' event
worker-arena         |       ^
worker-arena         | 
worker-arena         | Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
worker-arena         |     at Object.exports._errnoException (util.js:1016:11)
worker-arena         |     at exports._exceptionWithHostPort (util.js:1039:20)
worker-arena         |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1138:14)
worker-arena         | [nodemon] app crashed - waiting for file changes before starting...

标签: dockerredisdocker-composequeue

解决方案


推荐阅读