1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| db.example.drop();
db.example.createIndex( { b : 1, c : 1, d : 1 } );
sh.enableSharding("test");
sh.shardCollection("test.example", { b : 1, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 2, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 3, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 4, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 5, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 6, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 7, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 8, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 9, c : 1, d : 1 } );
sh.splitAt("test.example", { b : 10, c : 1, d : 1 } );
sleep(30000);.
sh.status();
for (i=1; i<=10; i++) {
for (j=1; j<=10; j++) {
for (k=1; k<=10; k++) {
var x = [];
for (l=1; l<=10; l++) {
for (m=1; m<=10; m++) {
for (n=1; n<=10; n++) {
x.push( { a : i, b : j, c : k, d : l, e: m, f: n } );
}
}
};
db.example.insert(x);
};
};
}; |
Partager