Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MongoDB:新配置1中描述的副本集[name]没有主机映射到此节点_Mongodb - Fatal编程技术网

MongoDB:新配置1中描述的副本集[name]没有主机映射到此节点

MongoDB:新配置1中描述的副本集[name]没有主机映射到此节点,mongodb,Mongodb,MongoDB向我抛出了这个错误,我不知道为什么。DNS是正确的,正如您在我的rs.initiate配置中所看到的,我放置的域与当前连接的域相同。我也尝试过使用IP,但也没用 root@vm326877:~/docker/mongo# mongo 01.mongodb.REDACTED.nl --tls --authenticationDatabase admin -u admin -p MongoDB shell version v4.2.2 Enter password: connecti

MongoDB向我抛出了这个错误,我不知道为什么。DNS是正确的,正如您在我的rs.initiate配置中所看到的,我放置的域与当前连接的域相同。我也尝试过使用IP,但也没用

root@vm326877:~/docker/mongo# mongo 01.mongodb.REDACTED.nl --tls --authenticationDatabase admin -u admin -p
MongoDB shell version v4.2.2
Enter password: 
connecting to: mongodb://01.mongodb.REDACTED.nl:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("b89142ed-1f8f-416c-84ec-ccd9303b2c08") }
MongoDB server version: 4.2.2
Server has startup warnings: 
2020-01-01T17:15:12.401+0100 I  STORAGE  [initandlisten] 
2020-01-01T17:15:12.401+0100 I  STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-01-01T17:15:12.401+0100 I  STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

> rs.initiate( {
...    _id : "REDACTED",
...    members: [
...       { _id: 0, host: "01.mongodb.REDACTED.nl:27017" },
...       { _id: 1, host: "02.mongodb.REDACTED.nl:27017" }
...    ]
... })
{
        "ok" : 0,
        "errmsg" : "No host described in new configuration 1 for replica set REDACTED maps to this node",
        "code" : 93,
        "codeName" : "InvalidReplicaSetConfig"
}
> 

如果实例证书上的公用名(CN)与成员数组中的主机字段不匹配,则可能发生这种情况。您可能拥有如下证书:

[me@myhost somedir]$ openssl x509 -in /path/to/ssl/certs/mongodb.pem -text
Certificate:
    Data:
        ...
        Issuer: ...
        Validity
            ...
        Subject: C = AB, O = CD, OU = EF, CN = some.other.host.org
        Subject Public Key Info:
            ...
当成员数组中使用的地址与配置的主机匹配时:

MongoDB > db.adminCommand({ getCmdLineOpts: 1 }).parsed.net.bindIp
the.actual.host.org
这种情况下的解决方案是为实例获取具有正确主机名的新证书