我今天正在使用我的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不同。
有人可以帮我弄清楚是什么触发了连接中断?
谢谢
答案 0 :(得分:1)
在给定的Project
范围内,针对" mongodb"的主机名的请求应该被路由到名为" mongodb"的Kubernetes Service
。 (如果有的话)。
调试此连接问题:
env
以列出前端可用的环境变量。如果在创建" mongodb"之后启动此容器。服务,配置字符串应该是可见的环境curl $MONGODB_SERVICE_HOST:$MONGODB_SERVICE_PORT
以验证mongodb
服务