local
Databaselocal
数据库On this page本页内容
Every 每个mongod
instance has its own local
database, which stores data used in the replication process, and other instance-specific data. mongod
实例都有自己的local
数据库,该数据库存储复制过程中使用的数据和其他特定于实例的数据。The local
database is invisible to replication: collections in the local
database are not replicated.local
数据库对复制不可见:local
数据库中的集合不会被复制。
mongod
Instancesmongod
实例上的集合local.startup_log
On startup, each 启动时,每个mongod
instance inserts a document into startup_log
with diagnostic information about the mongod
instance itself and host information. mongod
实例都会在startup_log
中插入一个文档,其中包含关于mongod
示例本身的诊断信息和主机信息。startup_log
is a capped collection. 是有封顶集合。This information is primarily useful for diagnostic purposes.该信息主要用于诊断目的。
For example, the following is a prototype of a document from the 例如,以下是startup_log
collection:startup_log
集合中文档的原型:
{ "_id" : "<string>", "hostname" : "<string>", "startTime" : ISODate("<date>"), "startTimeLocal" : "<string>", "cmdLine" : { "dbpath" : "<path>", "<option>" : <value> }, "pid" : <number>, "buildinfo" : { "version" : "<string>", "gitVersion" : "<string>", "sysInfo" : "<string>", "loaderFlags" : "<string>", "compilerFlags" : "<string>", "allocator" : "<string>", "versionArray" : [ <num>, <num>, <...> ], "javascriptEngine" : "<string>", "bits" : <number>, "debug" : <boolean>, "maxBsonObjectSize" : <number> } }
Documents in the startup_log
collection contain the following fields:startup_log
集合中的文档包含以下字段:
local.startup_log.startTime
A UTC ISODate value that reflects when the server started.反映服务器启动时间的UTC ISODate值。
local.startup_log.startTimeLocal
A string that reports the 报告系统本地时区中startTime
in the system's local time zone.startTime
的字符串。
local.startup_log.cmdLine
An embedded document that reports the 报告mongod
runtime options and their values.mongod
运行时选项及其值的嵌入式文档。
local.system.replset
local.system.replset
holds the replica set's configuration object as its single document. 将副本集的配置对象保存为其单个文档。To view the object's configuration information, issue 要查看对象的配置信息,请从rs.conf()
from mongosh
. mongosh
发出rs.conf()
。You can also query this collection directly.您也可以直接查询此集合。
local.oplog.rs
local.oplog.rs
is the capped collection that holds the oplog. 是包含oplog的封顶集合。You set its size at creation using the 您可以使用oplogSizeMB
setting. oplogSizeMB
设置在创建时设置其大小。To resize the oplog after replica set initiation, use the Change the Size of the Oplog procedure. 要在复制集启动后调整oplog的大小,请使用更改oplog的大小过程。For additional information, see the Oplog Size section.有关更多信息,请参阅Oplog大小部分。
Starting in MongoDB 4.0, the oplog can grow past its configured size limit to avoid deleting the 从MongoDB 4.0开始,oplog可以超过其配置的大小限制,以避免删除majority commit point
.majority
提交点。
Starting in MongoDB 5.0, it is no longer possible to perform manual write operations to the oplog on a cluster running as a replica set. 从MongoDB 5.0开始,不再可以在作为副本集运行的集群上对oplog执行手动写入操作。Performing write operations to the oplog when running as a standalone instance should only be done with guidance from MongoDB Support.当作为独立实例运行时,只能在MongoDB Support的指导下对oplog执行写操作。
local
local
多文档事务处理local
database inside a multi-document transaction.local
数据库中的集合执行读/写操作。local
local
的可重试写入You cannot perform write operations to collections in the 无法对启用了可重试写入的local
database with retryable writes enabled.local
数据库中的集合执行写入操作。
The official MongoDB 4.2-series drivers enable retryable writes by default. 官方MongoDB 4.2系列驱动程序默认启用可重试写入。Applications which write to the 写入local
database will encounter write errors upon upgrading to 4.2-series drivers unless retryable writes are explicitly disabled.local
数据库的应用程序在升级到4.2系列驱动程序时会遇到写入错误,除非明确禁用了可重试写入。
To disable retryable writes, specify 要禁用可重试写入,请在MongoDB集群的连接字符串中指定retryWrites=false
in the connection string for the MongoDB cluster.retryWrites=false
。