3
新手使用蒙戈2.0.1上試圖測試出碎片如下窗口32位:MongoDB的分片例如
(4)的過程:2個碎片+配置srver + mongos瓦特微小CHUNKSIZE
mongod.exe --shardsvr --port 10001 --dbpath <folder1> > shard1.log
mongod.exe --shardsvr --port 10002 --dbpath <folder2> > shard2.log
mongod.exe --configsvr --port 20000 --dbpath <configfolder> > config.log
mongos.exe --configdb localhost:20000 --chunkSize 1 > mongos.log
我跑了殼,並設置2個碎片:
mongos> use admin
switched to dbadmin
mongos> db.runCommand({ addshard : "localhost:10001" });
{ "shardAdded" : "shard0000", "ok" : 1 }
mongos> db.runCommand({ addshard : "localhost:10002" });
{ "shardAdded" : "shard0001", "ok" : 1 }
然後我啓用了分片的測試數據庫(dbTest)和集合(CTEST):
mongos> db.runCommand({ enablesharding : "dbTest" });
{ "ok" : 1 }
mongos> db.runCommand({ shardcollection : "dbTest.cTest", key : { Name : 1 } });
{ "collectionssharded" : "dbTest.cTest", "ok" : 1 }
最後我填充CTEST集合(按姓名索引)與1000005個樣品記錄:
mongos> use dbTest
switched to db dbTest
db.cTest.drop();
db.cTest.ensureIndex({ Name : 1 });
db.cTest.save({Name: "Frank", Age:56, Job: "Accountant", State: "NY"});
db.cTest.save({Name: "Bill" , Age:23, State: "CA"});
db.cTest.save({Name: "Janet", Age:34, Job: "Dancer" });
db.cTest.save({Name: "Andy", Age:44 });
db.cTest.save({Name: "Zach", Age:23, Job: "Fireman", State: "CA"});
i=1;
while(i<=1000)
{
j=1;
while (j<=1000)
{
db.cTest.save({Name:"Person("+i+","+j+")", Age:i+j});
j = j+1
};
i=i+1;
};
無論其...
看來,沒有什麼實際拿到分片。在配置數據庫中,db.chunks.count()爲零,我可以從windows explorer文件大小中看到所有數據進入第一個分片的物理文件設置設置,而第二個分片沒有。
任何人都可以發現我做錯了什麼,並提供一些關於如何管理的提示&調試這種類型的東西&看看發生了什麼?
謝謝
謝謝,納特就是這樣。 (我可以一直盯着那幾天而不留意!) – tpascale 2011-12-19 15:56:19