该项目托管在docker中,萝卜和节点有单独的容器
node:
image: node:12
container_name: node
volumes:
- ./:/var/www
working_dir: /var/www
tty: true
environment:
- "REDIS_PORT=6379"
- "REDIS_HOST=redis"
links:
- redis
networks:
- backend-network
- frontend-network
redis:
image: redis:6.0
container_name: redis
ports:
- "63791:6379"
networks:
- backend-network
restart: always
我进入节点容器并尝试启动回显服务器,laravel-echo-server start
之后我得到以下输出:
L A R A V E L E C H O S E R V E R
version 1.6.2
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
连接失败,接下来发生同样的事情,节点尝试启动回显服务器,但无法访问萝卜。告诉我可能是什么问题?
在 laravel 节点中
并在萝卜节点
端口一切正常吗?好吧,问题是为什么它会敲响 127.0.0.1。我会用 Laravel 调试节点中进入 env 的值。