Mongodb EHOSTUNREACH on Openshift Online 3 starter



我今天正在开发我的 Openshift 应用程序,在没有更改与 mongodb 连接相关的任何内容的情况下,我开始收到以下消息:

/opt/app-root/src/node_modules/mongodb/lib/server.js:242
        process.nextTick(function() { throw err; })
                                      ^
Error: connect EHOSTUNREACH 172.30.173.215:27017
    at Object.exports._errnoException (util.js:1020:11)
    at exports._exceptionWithHostPort (util.js:1043:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
npm info lifecycle bolao_2018@0.1.0~start: Failed to exec start script
npm ERR! Linux 3.10.0-693.21.1.el7.x86_64
npm ERR! argv "/opt/rh/rh-nodejs6/root/usr/bin/node" "/opt/rh/rh-nodejs6/root/usr/bin/npm" "run" "-d" "start"
npm ERR! node v6.11.3
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! bolao_2018@0.1.0 start: `node main`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bolao_2018@0.1.0 start script 'node main'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bolao_2018 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node main
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bolao_2018
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls bolao_2018
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /opt/app-root/src/npm-debug.log

不同的是,我看到由于某种原因,mongodb 服务尝试了新部署并失败,所以我手动运行了一个。

我还注意到它尝试连接的 IP 地址是 mongodb 的集群 IP,但当前运行的 pod 的节点 IP 是不同的。

有人可以帮助我弄清楚是什么触发了连接中断吗?

谢谢

在给定的Project范围内,指向主机名"mongodb"的请求应路由到名为"mongodb"的 Kubernetes Service(如果可用(。

要调试此连接问题,请执行以下操作:

  1. 尝试使用 OpenShift Web 控制台在前端容器中打开实时终端。前端容器必须与数据库服务位于同一项目范围内
  2. 键入 env 以列出前端可用的环境变量。如果此容器是在创建"mongodb"服务后启动的,则配置字符串应该在环境中可见
  3. 从实时终端运行curl $MONGODB_SERVICE_HOST:$MONGODB_SERVICE_PORT以验证mongodb服务的可用性

最新更新