MongoDB DBA · Question 465 · Single choice

40. Given the following commands that are run on the same machine and represent a replica set for testing purposes: mongod --sslMode requireSSL --sslPEMKeyFile server.pem --sslCAFile ca.pem --replSet myEncryptedReplSet --dbpath=r0/db --logpath=r0/db/mongo.log --port=27017 --fork mongod --sslMode requireSSL --sslPEMKeyFile server.pem --sslCAFile ca.pem --replSet myEncryptedReplSet --dbpath=r1/db --logpath=r1/db/mongo.log --port=27018 --fork mongod --sslMode requireSSL --sslPEMKeyFile server.pem --sslCAFile ca.pem --replSet myEncryptedReplSet --dbpath=r2/db --logpath=r2/db/mongo.log --port=27019 --fork What would be the correct set of next steps to initialize this replica set? (assume all certificates are bound to localhost) Choose the best answer:

Answer options

  1. A.
    $ mongo --replSet myEncryptedReplSet > rs.initiate({"_id": 'myEncryptedReplSet', "version":1, "members": [ {"_id": 0, "host": "localhost:27017"}, {"_id": 1, "host": "localhost:27018"}, {"_id": 2, "host": "localhost:27019"} ] })
  2. B.
    $ mongo --ssl --sslPEMKEYFile client.pem --sslCAFile ca.pem > rs.initiate({"_id": "myEncryptedReplSet"})
  3. C.
    $ mongo --ssl --replSet myEncryptedReplSet > rs.initiate({"_id": "myEncryptedReplSet", "version":1, "members": [ {"_id": 0, "host": "localhost:27017"}, {"_id": 1, "host": "localhost:27018"}, {"_id": 2, "host": "localhost:27019"} ] })
  4. D.
    $ mongo --ssl --sslPEMKEYFile client.pem --sslCAFile ca.pem > rs.initiate({ members: [ {"_id": 0, "host": "localhost:27017"}, {"_id": 1, "host": "localhost:27018"}, {"_id": 2, "host": "localhost:27019"} ] })
  5. E.
    $ mongo --ssl --sslPEMKEYFile client.pem --sslCAFile ca.pem > rs.initiate({"_id": 'myEncryptedReplSet', "version":1, "members": [ {"_id": 0, "host": "localhost:27017"}, {"_id": 1, "host": "localhost:27018"}, {"_id": 2, "host": "localhost:27019"} ] })

Answer confidence: High

Correct answer: E

Explanation language: Chinese

节点以 --sslMode requireSSL 启动,客户端必须带 --ssl,并且要用 --sslPEMKeyFile/--sslCAFile 提供证书与 CA 才能与开启 TLS 的成员通信;rs.initiate 的配置还必须包含 _id、version 和三个成员。A 缺 --ssl,C 只给 _id 不会加入其余成员,D 缺 _id,只有 E 完整正确。

Papers containing this question

This question appears in 1 bank records. Public pages combine identical prompts and options. Selected questions display the highest-confidence record; the others show a short preview. Paper-based learning preserves each record's answer, explanation, and confidence.

AUTHOR · PROJECTS · OPEN SOURCE

Author & MongoDB projects

Building data platforms, MongoDB migration and sync tools, and cloud operations products.

Contact the author for any MongoDB needs.

Contact the author ↗mlhp123@outlook.com

Support the author

If this question bank helps you, optional donations are welcome.

Scan with Alipay to support the authorOpen full-size donation image ↗