1. 程式人生 > >Linux下Mongodb的分散式分片群集(sharding cluster)配置

Linux下Mongodb的分散式分片群集(sharding cluster)配置

> db.runCommand({shardcollection:"test.c1", key: {id: 1}}););
> for (vari=0; i<=2000000; i++) {db.c1.save({id: i, value1: "1234567890",value2: "1234567890", value3: "1234567890", value4:"1234567890"}); };
> db.c1.stats()
{
        “sharded” : true,
        “ns” : “test.c1″,
        “count” : 200003,
        “size” : 25600384,
        “avgObjSize” : 128,
        “storageSize” : 44509696,
        “nindexes” : 2,
        “nchunks” : 15,
        “shards” : {
               “s1″ : {
                       “ns” : “test.c1″,
                       “count” : 141941,
                       “size” : 18168448,
                       “avgObjSize” : 128,
                       “storageSize” : 33327616,
                       “numExtents” : 8,
                       “nindexes” : 2,
                       “lastExtentSize” : 12079360,
                       “paddingFactor” : 1,
                       “flags” : 1,
                       “totalIndexSize” : 11157504,
                       “indexSizes” : {
                               “_id_” : 5898240,
                               “id_1″ : 5259264
                       },
                       “ok” : 1
               },
               “s2″ : {
                       “ns” : “test.c1″,
                       “count” : 58062,
                       “size” : 7431936,
                       “avgObjSize” : 128,
                       “storageSize” : 11182080,
                       “numExtents” : 6,
                       “nindexes” : 2,
                       “lastExtentSize” : 8388608,
                       “paddingFactor” : 1,
                       “flags” : 1,
                       “totalIndexSize” : 4579328,
                       “indexSizes” : {
                               “_id_” : 2416640,
                               “id_1″ : 2162688
                       },
                       “ok” : 1
               }
        },
        “ok” : 1
}