From c33c03893e616bfeca6f48404b3ddd9919f0edf4 Mon Sep 17 00:00:00 2001 From: littlesleep <398972669@qq.com> Date: Wed, 24 Sep 2014 01:34:21 +0800 Subject: [PATCH] Update manage-journaling.txt --- source/tutorial/manage-journaling.txt | 92 ++++++++++++--------------- 1 file changed, 41 insertions(+), 51 deletions(-) diff --git a/source/tutorial/manage-journaling.txt b/source/tutorial/manage-journaling.txt index 95398352318..611f1ebde37 100644 --- a/source/tutorial/manage-journaling.txt +++ b/source/tutorial/manage-journaling.txt @@ -1,81 +1,71 @@ ================= -Manage Journaling + 管理日志 ================= .. default-domain:: mongodb -MongoDB uses *write ahead logging* to an on-disk :term:`journal` to -guarantee :doc:`write operation ` durability -and to provide crash resiliency. Before applying a change to the data -files, MongoDB writes the change operation to the journal. If MongoDB -should terminate or encounter an error before it can write the changes -from the journal to the data files, MongoDB can re-apply the write -operation and maintain a consistent state. - -*Without* a journal, if :program:`mongod` exits unexpectedly, you must -assume your data is in an inconsistent state, and you must run either -:doc:`repair ` -or, preferably, :doc:`resync ` -from a clean member of the replica set. - -With journaling enabled, if :program:`mongod` stops unexpectedly, -the program can recover everything written to the journal, and the -data remains in a consistent state. By default, the greatest extent of lost -writes, i.e., those not made to the journal, are those made in the last -100 milliseconds. See :setting:`~storage.journal.commitIntervalMs` for more -information on the default. - -With journaling, if you want a data set to reside entirely in RAM, you -need enough RAM to hold the data set plus the "write working set." The -"write working set" is the amount of unique data you expect to see -written between re-mappings of the private view. For information on -views, see :ref:`journaling-storage-views`. +MongoDB使用*预写日志*记录到磁盘. :term:`日志`用来 +保证 :doc:`写操作 ` 的持久性 +和灾后恢复能力.在更改数据文件前 ,MongoDB将更改的操作写入到日志中. +如果MongoDB终止或遇到错误.然后才能写入到从数据文件日志的变化, +MongoDB可以重新申请写操作并保持一致的状态. + +*无* 日志记录, 如果 :program:`mongod` 意外退出,会发生数据不一直的状态, +你必须运行:doc:`修复 ` +或者, 最好, 清理复制集并:doc:`重新同步 ` + +启用了日志记录, 如果 :program:`mongod` 意外停止, +程序可以恢复所有写入日志的数据, 和数据保持一致的状态. +默认情况, 对最大程度上失去了写操作, 将保存最近100毫秒的数据. +请参考 :setting:`~storage.journal.commitIntervalMs` 上更多的默认信息. + +开启了日志,如果想要把数据集合全部放在内存,你需要足够的内存来保存 +数据集合加上"工作的数据集".这个"工作的数据集".是唯一的数据, +你想看写之间映射的视图.请参阅:ref:`journaling-storage-views`. .. important:: .. versionchanged:: 2.0 - For 64-bit builds of :program:`mongod`, journaling is enabled by - default. For other platforms, see :setting:`storage.journal.enabled`. + 64位构建的 :program:`mongod`, 日志是默认开启的. + 其它平台, 请参阅 :setting:`storage.journal.enabled`. -Procedures +程序 ---------- -Enable Journaling +启用日志记录 ~~~~~~~~~~~~~~~~~ .. versionchanged:: 2.0 - For 64-bit builds of :program:`mongod`, journaling is enabled by default. + :program:`mongod`, 默认情况下启用日志. -To enable journaling, start :program:`mongod` with the -:option:`--journal ` command line option. +要启用日志记录, 启动 :program:`mongod` 命令行的时候加上参数 +:option:`--journal ` . -If no journal files exist, when :program:`mongod` starts, it must -preallocate new journal files. During this operation, the -:program:`mongod` is not listening for connections until preallocation -completes: for some systems this may take a several minutes. During -this period your applications and the :program:`mongo` shell are not -available. +如果没有日志文件存在,当:program:`mongod` 启动,必须预分配新的日志文件. +在此操作期间,:program:`mongod`不会监听预分配的连接. +完成:对于某些系统中,这可能需要几分钟的时间.这期间你的应用程序和 +:program:`mongo` 都无法使用. -Disable Journaling +禁用日志 ~~~~~~~~~~~~~~~~~~ -.. warning:: +.. 警告:: - Do not disable journaling on production systems. If your - :program:`mongod` instance stops without shutting down cleanly - unexpectedly for any reason, (e.g. power failure) and you are - not running with journaling, then you must recover from an - unaffected :term:`replica set` member or backup, as described in - :doc:`repair `. + 不要在生产系统上禁用日志. 如果 + 不担心:program:`mongod` 意外停止, (比如:停电) + 你可以不用开启日志, 如果发生意外. + 那么你必须从一个未受影响的副本集成员或备份中恢复. + 参考资料::doc:`repair `. + -To disable journaling, start :program:`mongod` with the -:option:`--nojournal ` command line option. +要禁用日志记录, 启动 :program:`mongod` 命令行的时候加上参数 +:option:`--nojournal `. Get Commit Acknowledgment ~~~~~~~~~~~~~~~~~~~~~~~~~ You can get commit acknowledgment with the -:ref:`write-concern` and the ``j`` option. For details, see +:ref:`write-concern` 和 ``j`` 选项. 有关详细信息, 请参阅 :ref:`write-concern-operation`. .. _journaling-avoid-preallocation-lag: