草庐IT

MongoDB addshard : failed to add 2nd shard

coder 2023-10-31 原文

一共有6个目录,每个目录大概有1TB的数据,都属于一个数据库“test” 现在,我想将它们分组到一个集群中。我已经构建了 Shardserver 和 Configserver,但是在将第二个分片添加到集群时遇到了问题:

db.runCommand({addshard:localhost:27017});
db.runCommand({addshard:localhost:27027});

"errmsg" : "can't add shard localhost:27027 because a local database 'test' exists in another shard0000:localhost:27017"

删除'test'数据库可以解决这个问题,但这不是我想要的。

如何将 6 个分片(它们都有“测试”数据库,属于一个逻辑数据库)合并在一起?

最佳答案

使用 mongodump 第二个分片上的数据,然后删除该数据库并添加分片。之后,您可以使用 mongorestore

导入转储数据

关于MongoDB addshard : failed to add 2nd shard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16412485/

有关MongoDB addshard : failed to add 2nd shard的更多相关文章

随机推荐