【发布时间】:2020-11-20 14:16:04
【问题描述】:
我正在尝试在单个 heroku dyno 中运行的 2 个进程之间建立通信,根据本文档,这应该是可能的: https://devcenter.heroku.com/articles/dynos#networking
Individual processes within a dyno can bind to any address or port they want and communicate among them using e.g. standard TCP
我正在尝试使用 http,并且代码在我的开发机器上运行良好。但是当我尝试在heroku上执行同样的事情时,源进程无法连接到目标进程。一个进程使用 nodejs 运行,另一个进程使用 python 运行。
这是 Procfile 的内容:
web: npm run start
worker: python3 -m scripts.app
这是来自原始节点进程的 axios 错误消息的一部分:
020-11-17T18:30:22.385020+00:00 app[web.1]: Inside nltk error block
2020-11-17T18:30:22.387506+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:5010
2020-11-17T18:30:22.387507+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
2020-11-17T18:30:22.387508+00:00 app[web.1]: errno: 'ECONNREFUSED',
2020-11-17T18:30:22.387508+00:00 app[web.1]: code: 'ECONNREFUSED',
2020-11-17T18:30:22.387509+00:00 app[web.1]: syscall: 'connect',
2020-11-17T18:30:22.387509+00:00 app[web.1]: address: '127.0.0.1',
2020-11-17T18:30:22.387509+00:00 app[web.1]: port: 5010,
【问题讨论】:
标签: http heroku networking