MongoDB日记记录:当客户端请求非日记记录写入并且在Mongod上激活日记记录时使用的日记文件 [英] MongoDB Journaling : Is the journal file used when the client request a non journal write and journaling is activated on Mongod

查看:130
本文介绍了MongoDB日记记录:当客户端请求非日记记录写入并且在Mongod上激活日记记录时使用的日记文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解日记的工作原理:那是正确的吗?

I try to uderstand how journaling is exactly working : is that correct ?

在服务器端未激活日记功能时(mongod --nojournal):

When no journaling is activated on the server side (mongod --nojournal) :

  1. (a)如果客户端请求日记记录,它将输出错误(从2.6开始,在被忽略之前),
  2. (b)如果客户端请求未记录日志,将不使用日志记录,因此我猜将在RAM上进行更改,然后操作系统将在60秒后将更改刷新到数据文件.

在Mongod上启用日记功能(mongod --journal(64位版本默认):

When journaling is activated on Mongod (mongod --journal (default on 64 bits version):

  1. (a)如果客户端请求日志记录写入,则mongoDB仅在将数据提交到日志之后才在主节点中确认写入,也使客户端不必花费太多时间来执行写入操作,Mongod会减少提交间隔.
  2. (b)如果客户端请求无日志记录的写入,则mongoDB将使用该日志记录并从主节点确认写入,而无需等待将数据提交到日志记录.

我实际上没有在官方文档中找到关于案例2(b)的任何内容,有人可以确认当j在客户端为false却在mongod上启用了日记功能时是否使用了日记?

I actually did not find anything in the official documentation about case 2(b), could someone confirm if journal is used when j is false on the client side but journaling is activated on the mongod ?

推荐答案

您的断言都是正确的.我认为您使用的语言令人困惑,但是可能会使您感到困惑.客户不请求日记或非日记的写.如果启用日记功能,则无论客户端执行什么操作,都会记录写操作.客户端包括的是写关注点,它需要一定程度的数据复制(w参数)和/或日志记录(j参数),然后服务器响应写入成功.您所说的非日志写入是j = 0,这意味着服务器将成功响应,而无需等待将写入日志提交给日志. j = 1表示服务器在提交到日志之前不会响应该写操作.

Your assertions are all correct. I think the language you are using is confusing and may be confusing you a little bit, however. Clients don't request writes that are journaled or non-journaled. If journaling is on, writes will be journaled, regardless of what the client does. What the client includes is a write concern that requires a certain level of data replication (the w parameter) and/or journaling (the j parameter) before the server responds that the write is a success. What you mean by a non-journaled write is j = 0, which means the server will respond with success without waiting for the write to be committed to the journal; j = 1 means the server will not respond to the write until it has been committed to the journal.

w参数控制成功响应所需的数据复制级别.在上面的链接中有更多详细信息.

The w parameter controls the level of replication of the data necessary for a successful response. There's more detail in the link above.

这篇关于MongoDB日记记录:当客户端请求非日记记录写入并且在Mongod上激活日记记录时使用的日记文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆