Chinaunix首页 | 论坛 | 博客
  • 博客访问: 428528
  • 博文数量: 137
  • 博客积分: 5190
  • 博客等级: 大校
  • 技术积分: 997
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-21 16:19
文章存档

2011年(17)

2010年(120)

我的朋友

分类: 数据库开发技术

2011-07-07 15:02:56

    Database Record/Replay (diagLogging command)

Recording database operations, and replaying them later, is sometimes a good way to reproduce certain problems in a controlled environment.

To enable logging:打开日志记录

db._adminCommand( { diagLogging : 1 } )

To disable:关闭日志记录

db._adminCommand( { diagLogging : 0 } )

Values for diagLogging:参数值含义

  • 0 off. Also flushes any pending data to the file.
  • 1 log writes
  • 2 log reads
  • 3 log both
    Note: if you log reads, it will record the findOnes above and if you replay them, that will have an effect!

Output is written to diaglog.bin_ in the /data/db/ directory (unless --dbpath is specified).

To replay the logged events:恢复日志的方式

nc ''database_server_ip'' 27017 < ''somelog.bin'' | hexdump -c
阅读(6737) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~