ITeye博客

MongoDB使用

duming115 · 2012-09-19 15:57 · MongoDB · 数据库 · Markdown

2012.09.19

  1. db.users.find().limit(100);
  2. it 可以将其余的显示出来.
  3. 查看索引 db.users.getIndexes();
  4. 性能耗时查询 db.setProfilingLevel(2); db.setProfilingLevel( level , slowms ); db.setProfilingLevel( 1 , 10 ); 查询 db.system.profile.find( { millis : { $gt : 5 } } ); db.system.profile.find().sort({$natural:-1}).limit(1)
  5. 使用 /usr/local/cloud/mongodb/bin/mongosniff --source NET lo 报错 /usr/local/cloud/mongodb/bin/mongosniff: error while loading shared libraries: libpcap.so.0.9: cannot open shared object file: No such file or directory 是需要libpcap库, 使用yum install libpcap-devel安装后, 还报 /usr/local/cloud/mongodb/bin/mongosniff: error while loading shared libraries: libpcap.so.0.9: cannot open shared object file: No such file or directory 错误, 是因为yum安装的libpcap-devel 1.0.0 版本, 要创建一个软连接:ln -s /usr/lib64/libpcap.so.1.0.0 /usr/lib64/libpcap.so.0.9 , 然后以root权限启动最初的命令就可以了.
  6. db.serverStatus();可以查看当前服务器的状态.
  7. db.stats();查看数据库状态信息.
  8. db.runCommand({ listshards: 1 }); use admin, 查看所有的shard配置.
  9. printShardingStatus(); 可以查看sharding 的更多信息, 及表的sharding.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。