我已经看到用于预分割数据Link
的用法perl脚本问题>我该如何运行这个脚本?
我提出这个问题的原因是perl脚本不包含如下典型语句:
use MongoDB;
另外,我没有看到它使用MongoDB Perl驱动程序。
///更新/// 以下是脚本的输出:
use admin;
db.runCommand({split: "archive.postings", middle: { PostingID: 95326 } });
db.runCommand({moveChunk: "archive.postings", find: { PostingID: 95326 }, to: "archive001"});
db.runCommand({split: "archive.postings", middle: { PostingID: 190651 } });
db.runCommand({moveChunk: "archive.postings", find: { PostingID: 190651 }, to: "archive002"});
db.runCommand({split: "archive.postings", middle: { PostingID: 285976 } });
db.runCommand({moveChunk: "archive.postings", find: { PostingID: 285976 }, to: "archive003"});
db.runCommand({split: "archive.postings", middle: { PostingID: 381301 } });
db.runCommand({moveChunk: "archive.postings", find: { PostingID: 381301 }, to: "archive001"});
db.runCommand({split: "archive.postings", middle: { PostingID: 476626 } });
db.runCommand({moveChunk: "archive.postings", find: { PostingID: 476626 }, to: "archive002"});
db.runCommand({split: "archive.postings", middle: { PostingID: 571951 } });
db.runCommand({moveChunk: "archive.postings", find: { PostingID: 571951 }, to: "archive003"});
问题>首先,我在MongoDB上运行上面的脚本。现在,如果我按如下方式插入文档:
db.postings.insert({PostingID : 95327, xx : xxxxxxxx})
MongoDB会在archive001上发送插入的数据吗?
答案 0 :(得分:1)
根据评论,看起来脚本只是用于创建一组命令,您应该能够在Mongo中运行以预先对数据库进行分片。
当你想到它时它变得非常简单......如果它甚至不打算执行命令就不需要Mongo! : - )
答案 1 :(得分:1)
该脚本有效地为MongoDB生成脚本。