gpt4 book ai didi

mongodb - 就绪探测失败 : MongoDB shell version v4. 0.10

转载 作者:行者123 更新时间:2023-12-02 11:32:13 26 4
gpt4 key购买 nike

在 kubernetes 中运行 monogodb 时出现以下错误:-

我试图改变 mongodb 的形象

Warning  Unhealthy  2m28s  kubelet, minikube  Readiness probe failed: MongoDB 
shell version v4.0.10
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-06-08T15:25:01.774+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed
Warning Unhealthy 2m17s kubelet, minikube Readiness probe failed: MongoDB shell version v4.0.10
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-06-08T15:25:12.008+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed

最佳答案

一旦我增加了 initialDelaySeconds:,我就观察到了同样的错误Readiness 中某个更高数字的值在部署中探测规范,问题已经解决 mongodb Pod 已生成且没有错误。实际上,docker需要一些时间才能拉起docker.io/bitnami/mongodb图像并初始化套接字 mongodb listener,因此 Readiness 探测器指示问题,而容器进程尚未准备好网络连接。

    readinessProbe:
exec:
command:
- mongo
- --eval
- db.adminCommand('ping')
failureThreshold: 6
initialDelaySeconds: 360
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5

同时,您可以查看mongodb任何入站连接状态或任何相关事件的 Pod。

kubectl logs <mongodb-Pod-name>

我用过 stable/mongodb Helm chart部署MongoDB,发现和你类似的错误:

helm install --name mongodb stable/mongodb

Warning Unhealthy 38m kubelet, gke-helm-test-default-pool-efed557c-52tf Readiness probe failed: MongoDB shell version v4.0.9 connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb 2019-06-10T12:46:46.054+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:343:13 @(connect):2:6 exception: connect failed

当我做了一些调整并获得了readinessProbe.initialDelaySeconds从 5 秒到 360 秒,mongodb容器运行无任何故障。

helm install --name mongodb stable/mongodb --set readinessProbe.initialDelaySeconds=360

关于mongodb - 就绪探测失败 : MongoDB shell version v4. 0.10,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56507888/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com