全部博文(150)
分类: NOSQL
2017-04-05 16:24:36
goluk:PRIMARY> show databases; ..... local 42.058GB ...... test 0.078GB trip 281.816GB
goluk:PRIMARY> db.stats(); { "db" : "test", "collections" : 3, "objects" : 5, "avgObjSize" : 60.8, "dataSize" : 304, "storageSize" : 20480, "numExtents" : 3, "indexes" : 1, "indexSize" : 8176, "fileSize" : 67108864, "nsSizeMB" : 16, "extentFreeList" : { "num" : 0, "totalSize" : 0 }, "dataFileVersion" : { "major" : 4, "minor" : 22 }, "ok" : 1 }
goluk:PRIMARY> use trip switched to db trip goluk:PRIMARY> show tables; inc_ids system.indexes ......
goluk:PRIMARY> db.trip_track.stats(); { "ns" : "trip.trip_track", "count" : 9666824, "size" : 4794744704, "avgObjSize" : 496, "numExtents" : 24, "storageSize" : 7159508992, "lastExtentSize" : 1861685248, "paddingFactor" : 1, "paddingFactorNote" : "paddingFactor is unused and unmaintained in 3.0. It remains hard coded to 1.0 for compatibility only.", "userFlags" : 1, "capped" : false, "nindexes" : 5, "totalIndexSize" : 5580128176, "indexSizes" : { "_id_" : 356604416, "partid_1" : 1025090528, "partid_1_uploadtime_1" : 1200138688, "carid_1_partid_1" : 1796888576, "carid_1_uploadtime_1" : 1201405968 }, "ok" : 1 }
goluk:PRIMARY> db.trip_track.totalSize(); 12739637168 goluk:PRIMARY> db.trip_track2.totalSize(); goluk:PRIMARY> db.trip_track_1.totalSize(); 58456562656 goluk:PRIMARY> db.trip_track_2.totalSize(); 59122694080 goluk:PRIMARY> db.trip_track_3.totalSize(); 64272991520
{ "desc" : "conn2831006", "threadId" : "0xbeb3380", "connectionId" : 2831006, "opid" : 694360071, ......
杀掉进程
db.killOp(694360071)
查找示例
db.trip_track_1.find({'carid':'ssxxddd'}).limint(10);
查看各个表名命令
goluk:PRIMARY> show tables; inc_ids system.indexes trip_baiducitycode trip_cars trip_channel trip_device trip_device_datausage trip_group trip_ipc trip_live_video trip_phone_history trip_pic trip_properties trip_router_state trip_track trip_track_1 trip_track_2 trip_track_3 trip_track_4 trip_track_5 trip_track_part trip_track_table trip_video trip_weixin_rela trip_weixin_sub update_goluk_mobileid update_goluk_model update_ipc_version
# cat show.sh #!/bin/sh MONGO=/usr/local/bin/mongo DB=trip $MONGO << EOF use $DB; show tables; EOF
sh show.sh |head -n -1 |tail -n +4 >s2.sql
for i in `cat s2.sql` ; do echo "db.$i.totalSize()" ;done
mongo < s3.sql |head -n -1 |tail -n +4
goluk:PRIMARY> show dbs; ...... local 42.058GB ...... test 0.078GB trip 311.802GB
表 Byte MB trip_track 12534166112 11,953.51 trip_track_1 58456562656 55,748.52 trip_track_2 59122694080 56,383.79 trip_track_3 64272991520 61,295.50 trip_track_4 95992970944 91,546.03 trip_track_5 13836463920 13,195.48