MongoDB Sharded Bitnami Helm Chart,如何设置root密码?

问题描述 投票:0回答:1

我正在尝试使用 bitnami Helm Chart 设置 mongodb 分片设置。我只是尝试设置 rootPassword,但服务器似乎不再启动。在配置服务器中,我看到

{"t":{"$date":"2022-10-23T10:44:04.360+00:00"},"s":"I",  "c":"NETWORK",  "id":4712102, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"Host failed in replica set","attr":{"replicaSet":"mongo-mongodb-sharded-shard-0","host":"mongo-mongodb-sharded-shard0-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017","error":{"code":6,"codeName":"HostUnreachable","errmsg":"Error connecting to mongo-mongodb-sharded-shard0-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017 :: caused by :: Could not find address for mongo-mongodb-sharded-shard0-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017: SocketException: Host not found (authoritative)"},"action":{"dropConnections":true,"requestImmediateCheck":false,"outcome":{"host":"mongo-mongodb-sharded-shard0-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017","success":false,"errorMessage":"HostUnreachable: Error connecting to mongo-mongodb-sharded-shard0-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017 :: caused by :: Could not find address for mongo-mongodb-sharded-shard0-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017: SocketException: Host not found (authoritative)"}}}}
{"t":{"$date":"2022-10-23T10:44:04.361+00:00"},"s":"I",  "c":"-",        "id":4333222, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"RSM received error response","attr":{"host":"mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017","error":"HostUnreachable: Error connecting to mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017 :: caused by :: Could not find address for mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017: SocketException: Host not found (authoritative)","replicaSet":"mongo-mongodb-sharded-shard-1","response":{}}}
{"t":{"$date":"2022-10-23T10:44:04.361+00:00"},"s":"I",  "c":"NETWORK",  "id":4712102, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"Host failed in replica set","attr":{"replicaSet":"mongo-mongodb-sharded-shard-1","host":"mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017","error":{"code":6,"codeName":"HostUnreachable","errmsg":"Error connecting to mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017 :: caused by :: Could not find address for mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017: SocketException: Host not found (authoritative)"},"action":{"dropConnections":true,"requestImmediateCheck":false,"outcome":{"host":"mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017","success":false,"errorMessage":"HostUnreachable: Error connecting to mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017 :: caused by :: Could not find address for mongo-mongodb-sharded-shard1-data-0.mongo-mongodb-sharded-headless.default.svc.cluster.local:27017: SocketException: Host not found (authoritative)"}}}}

然后我尝试查看碎片:

mongodb 10:44:47.02 INFO  ==> Trying to connect to MongoDB server mongo-mongodb-sharded...
timeout reached before the port went into state "inuse"

还有分片的mongos

│ mongodb 10:44:42.82 INFO  ==> Trying to connect to MongoDB server mongo-mongodb-sharded-configsvr-0.mongo-mongodb-sharded-headless.default.svc.cluster.lo │
│ mongodb 10:44:42.83 INFO  ==> Found MongoDB server listening at mongo-mongodb-sharded-configsvr-0.mongo-mongodb-sharded-headless.default.svc.cluster.loca │
│ MongoServerError: Authentication failed.                                                                                                                  │
│ MongoServerError: Authentication failed.                                                                                                                  │

似乎分片 mongos 因身份验证错误而关闭?但为什么呢?

我的

Chart.yaml

apiVersion: v2
name: experiment-mongo-sharding
description: 
type: application
version: 0.1.0
appVersion: "1.16.0"

dependencies:
  - name: mongodb-sharded
    version: 6.0.2
    repository: https://charts.bitnami.com/bitnami

values.yaml

mongodb-sharded:
  auth:
     rootUser: root
     rootPassword: password
     replicaSetKey: somesecret

这里出了什么问题?

此外,一旦启动,我如何连接到它?

mongodb kubernetes-helm bitnami
1个回答
0
投票

我遇到了一些像您的情况一样的问题,并收到以下日志:

在端口进入“使用”状态之前已达到超时

MongoServerError:身份验证失败。

我增加了 Pod 资源,此操作后一切顺利。

© www.soinside.com 2019 - 2024. All rights reserved.