无法使用mongorestore在MongoDb Atlas中添加数据库用户?

时间:2019-08-07 09:18:05

标签: mongodb mongodb-atlas

在我的本地主机上,我有这个“ evaluetoncoin”数据库专用用户,这些用户在customData常规mongoDb对象中包含一些强制性个人数据:

localhost

在mongoDb Atlas上,似乎我不能添加这些用户,而只能添加普通用户”: enter image description here

如何将我的数据库用户添加到ONLINE MONGODB ATLAS上,导致他们将customData用作一些重要的个人数据?

编辑:

这是我的命令,试图在mongodb地图集上还原我的本地主机db用户:

mongorestore --host群集0-shard-0 / cluster0-shard-00-00-6kmcn.azure.mongodb.net:27017,cluster0-shard-00-01-6kmcn.azure.mongodb.net:27017,cluster0 -shard-00-02-6kmcn.azure.mongodb.net:27017 --ssl-用户名nicolas-密码xxxxxx --authentication数据库管理--db evaluetoncoin dump / evaluetoncoin --restoreDbUsersAndRoles

nicolas是atlasAdmin @ admin,是管理员

集合已正确还原,但用户未正确还原,这是控制台中的错误:

019-08-07T12:13:01.392+0200    building a list of collections to restore from dump\evaluetoncoin dir
2019-08-07T12:13:01.963+0200    reading metadata for evaluetoncoin.evaluations from dump\evaluetoncoin\evaluations.metadata.json
2019-08-07T12:13:02.295+0200    restoring evaluetoncoin.evaluations from dump\evaluetoncoin\evaluations.bson
2019-08-07T12:13:03.260+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:06.260+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:09.261+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:12.260+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:15.259+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:18.259+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:21.259+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:24.261+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:27.259+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:30.260+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:33.259+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:36.261+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:38.914+0200    [########################]  evaluetoncoin.evaluations  3.50MB/3.50MB  (100.0%)
2019-08-07T12:13:38.914+0200    no indexes to restore
2019-08-07T12:13:38.916+0200    finished restoring evaluetoncoin.evaluations (1 document)
2019-08-07T12:13:38.918+0200    restoring users from dump\evaluetoncoin\$admin.system.users.bson
2019-08-07T12:13:39.259+0200    admin.tempusers  1.47KB
2019-08-07T12:13:39.502+0200    error: not authorized on admin to execute command { insert: "tempusers", documents: [[{_id evaluetoncoin.admin} {userId {4 [98 156 219 226 246 40 65 28 182 238 130 112 149 191 50 183]}} {user admin} {db evaluetoncoin} {credentials [{SCRAM-SHA-1 [{iterationCount 10000} {salt QT+a1aNgHIiP9pklquBzLQ==} {storedKey ZUNe3kmthUwl/IhKuJNYw50NyfM=} {serverKey XiMV8Xh1Fk60V17kJ0MgKUUfeP0=}]} {SCRAM-SHA-256 [{iterationCount 15000} {salt OZ+aIiLaLVz0kua27gRsmrQy1qeAg5i7NMdKcg==} {storedKey WlRrY8Jy3SFZr/84ZyJFvv4K96OAlClReSZ+AiNoIDo=} {serverKey 9JB8f16OepHO/B3xmLeIODx8Xav8cxNuq2ZE9ydERo8=}]}]} {customData [{nom admin} {prenom Admin} {email admin@admin.fr} {compagnie applicationsh} {website applicationsh.fr} {adresse rue de lilas} {ville Plouray} {departement 56770}]} {roles [[{role readWrite} {db evaluetoncoin}]]}] [{_id evaluetoncoin.jose} {userId {4 [183 243 195 93 85 169 65 192 161 31 242 207 127 61 219 185]}} {user jose} {db evaluetoncoin} {credentials [{SCRAM-SHA-1 [{iterationCount 10000} {salt +XnVgwT/EVWdPemOnSU0gA==} {storedKey L21CxLv7xP/a/t8nmje/1k1BjEE=} {serverKey f3+p8LkOEgikG7P0F+vbOhX3QRI=}]} {SCRAM-SHA-256 [{iterationCount 15000} {salt hke7KMZPRD+G0Tri+j97aOj7m/pCCRetqXieDA==} {storedKey veqWJnkRGAdVVk89GqmNhXV+WqN/5VESo/iCdOdI5/U=} {serverKey Knl1N6NTddVeeM0EPo4lZ91JoOQabt7yzX4lIQIAh38=}]}]} {customData [{nom jose} {prenom jose} {email jose@admin.fr} {compagnie applicationsh} {website applicationsh.fr} {adresse rue de lilas} {ville Plouray} {departement 56770}]} {roles [[{role readWrite} {db evaluetoncoin}]]}]], writeConcern: { getLastError: 1, w: "majority" }, ordered: false }
2019-08-07T12:13:39.504+0200    admin.tempusers  1.47KB
2019-08-07T12:13:39.505+0200    roles file 'dump\evaluetoncoin\$admin.system.roles.bson' is empty; skipping roles restoration
2019-08-07T12:13:39.506+0200    restoring roles from dump\evaluetoncoin\$admin.system.roles.bson
2019-08-07T12:13:40.641+0200    Failed: restore error: error running merge command: not authorized on admin to execute command { _mergeAuthzCollections: 1, tempUsersCollection: "admin.tempusers", tempRolesCollection: "admin.temproles", drop: false, writeConcern: { w: "majority" }, db: "evaluetoncoin" 

EDit 2:

他们对我说,addUser()在其平台上不可用!

我应该使用哪个主机与localhost用户管理相同的主机?

我需要将用户个人数据存储在customData对象中!

请在那里看看,我真的需要使用customData:

https://docs.mongodb.com/manual/reference/method/db.createUser/

customData文档可选。任何任意信息。此字段可用于存储管理员希望与此特定用户关联的任何数据。例如,这可以是用户的全名或员工ID。

请问,有人知道使用adduser()或createUser()函数启动的mongoDb托管吗?

0 个答案:

没有答案