Configuration File(配置文件)

File Format(文件格式)
Use the Configuration File(使用配置文件)

Core Options(核心设置)

systemLog Options(系统log设置)
processManagement Options(进程管理设置)
net Options(网络设置)
security Options(安全设置)
setParameter Option(自定义参数设置)
storage Options(存储设置)
operationProfiling Options(性能设置)
replication Options(复制集设置)
sharding Options(分片设置)
auditLog Options()
snmp Options()
Text Search Options(文本搜索设置)

mongos-only Options(mongo单独设置)
Windows Service Options(windows系统设置)


Configuration File

File Format

You can configure mongod and mongos instances at startup using a configuration file. The configuration file contains settings that are equivalent to the mongod and mongos command-line options.
Using a configuration file makes managing mongod and mongos options easier, especially for large-scale deployments. You can also add comments to the configuration file to explain the server’s settings.
If you installed from a package and have started MongoDB using your system’s init script, you are already using a configuration file.

您可以使用配置文件在启动时配置mongod和mongos实例。 配置文件包含等效于mongod和mongos命令行选项的设置。
使用配置文件使管理mongod和mongos选项更容易,特别是对于大规模部署。 您还可以向配置文件添加注释,以说明服务器的设置。
如果从一个包安装并使用系统的init脚本启动了MongoDB,那么您已经在使用配置文件了。

File Format
IMPORTANT
Changed in version 2.6: MongoDB 2.6 introduces a YAML-based configuration file format. The 2.4 configuration file format remains for backward compatibility.
MongoDB configuration files use the YAML format [1].
The following sample configuration file contains several mongod settings that you may adapt to your local configuration:
NOTE
YAML does not support tab characters for indentation: use spaces instead.

文件格式
重要
2.6版本更改:MongoDB 2.6引入了基于YAML的配置文件格式。 2.4配置文件格式保持向后兼容。
MongoDB配置文件使用YAML格式[1]。
以下示例配置文件包含几个您可以适应本地配置的mongod设置:
注意
YAML不支持缩进的制表符:使用空格。

systemLog:
destination: file
path: "/var/log/mongodb/mongod.log"
logAppend: true
storage:
journal:
enabled: true
processManagement:
fork: true
net:
bindIp: 127.0.0.1
port: 27017
setParameter:
enableLocalhostAuthBypass: false
...

The Linux package init scripts included in the official MongoDB packages depend on specific values for systemLog.path, storage.dbpath, and processManagement.fork. If you modify these settings in the default configuration file, mongod may not start.

YAML is a superset of JSON.

官方MongoDB包中包含的Linux包初始化脚本取决于systemLog.path,storage.dbpath和processManagement.fork的特定值。 如果在默认配置文件中修改这些设置,mongod可能无法启动。
YAML是JSON的超集。

Use the Configuration File

To start mongod or mongos using a config file, specify the config file with the --config option or the -f option, as in the following examples:
The following examples use the --config option for mongod and mongos:

要使用配置文件启动mongod或mongos,请使用--config选项或-f选项指定配置文件,如以下示例所示:
以下示例使用mongod和mongos的--config选项:

mongod --config /etc/mongod.conf

mongos --config /etc/mongos.conf

也可以

mongod -f /etc/mongod.conf

mongos -f /etc/mongos.conf


Core Options

systemLog Options

systemLog:
   verbosity: <int>(日志组件记录等级)
   quiet: <boolean>(是否限制输出量)
   traceAllExceptions: <boolean>(是否打印详细日志用于调试)
   syslogFacility: <string>(设置syslog级别) 
   path: <string>(日常操作记录日志目录)
   logAppend: <boolean>(日志是否采用追加形式)
   logRotate: <string>(日志重新打开)
   destination: <string>(所有日志记录地址)
   timeStampFormat: <string>(时间戳格式)
   component:(以下日志操作级别都是0-5)
      accessControl:(访问控制)
         verbosity: <int>(日志记录级别)
      command:
         verbosity: <int>(日志记录级别)
      storage:
         verbosity: <int>(存储日志记录级别)
         journal:
            verbosity: <int>
      write:
         verbosity: <int>(写操作)
 sharding:
verbosity: <int>(分片)
 replication:
verbosity: <int>(复制集)
 query:
verbosity: <int>(查询)
 network:
verbosity: <int>(网络)
 index:
verbosity: <int>(索引)
 geo:
verbosity: <int>(地理空间)
 ftdc:
verbosity: <int>(诊断数据收集)
 control:
verbosity: <int>(控制操作)

processManagement Options

processManagement:
fork: <boolean>(是否后台启动)
pidFilePath: <string>(指定一个文件存储进程ID数据)
processManagement.fork

Enable a daemon mode that runs the mongos or mongod process in the background. By default mongos or mongod does not run as a daemon: typically you will run mongos or mongod as a daemon, either by using processManagement.fork or by using a controlling process that handles the daemonization process (e.g. as with upstart and systemd).
The Linux package init scripts do not expect processManagement.fork to change from the defaults. If you use the Linux packages and change processManagement.fork, you will have to use your own init scripts and disable the built-in scripts.

指定一个文件位置来保存mongos或mongod进程的进程ID,其中mongos或mongod将会写入其PID。 这对于跟踪--fork选项的跟踪mongos或mongod过程非常有用。 没有指定的processManagement.pidFilePath选项,该进程将不创建PID文件。

processManagement.pidFilePath

Specifies a file location to hold the process ID of the mongos or mongod process where mongos or mongod will write its PID. This is useful for tracking the mongos or mongod process in combination with the --fork option. Without a specified processManagement.pidFilePath option, the process creates no PID file.
指定一个文件位置来保存mongos或mongod进程的进程ID,其中mongos或mongod将会写入其PID。 这对于跟踪--fork选项的跟踪mongos或mongod过程非常有用。 没有指定的processManagement.pidFilePath选项,该进程将不创建PID文件。

 

net Options

net:
port: <int>(实例端口)
bindIp: <string>(指定请求IP)
maxIncomingConnections: <int>(实例最大客户端连接数)
wireObjectCheck: <boolean>(写操作校验)
ipv6: <boolean>(是否启用ip6,3.0版本默认开启)
unixDomainSocket:
enabled: <boolean>(UNIX系统下,是否启用套接字监听)
pathPrefix: <string>(UNIX套接字地址)
filePermissions: <int>(设置套接字文件权限)
http:
enabled: <boolean>(3.2版本已弃用)
JSONPEnabled: <boolean>(3.2版本已弃用)
RESTInterfaceEnabled: <boolean>(3.2版本已弃用)
ssl:
sslOnNormalPorts: <boolean> (2.6版本已弃用)是否开启 TSL\SSL
mode: <string>
PEMKeyFile: <string>
PEMKeyPassword: <string>
clusterFile: <string>
clusterPassword: <string>
CAFile: <string>
CRLFile: <string>
allowConnectionsWithoutCertificates: <boolean>
allowInvalidCertificates: <boolean>
allowInvalidHostnames: <boolean>
disabledProtocols: <string>
FIPSMode: <boolean>
compression:
compressors: <string>

https://docs.mongodb.com/manual/reference/configuration-options/#use-the-configuration-file

MongoDB-配置翻译的更多相关文章

  1. hadoop生态搭建(3节点)-13.mongodb配置

    # 13.mongodb配置_副本集_认证授权# ==================================================================安装 mongod ...

  2. centos中docker mongodb 配置

    安装docker,对于Centos7,如下: $ sudo yum update$ sudo yum -y install docker$ sudo systemctl start docker 首先 ...

  3. 把Mongodb配置成windows服务

    在mongodb/bin 下运行命令窗口需要配置日志和db路径,如下:mongod --logpath d:\mongo\logs\logfilename.log --logappend --dbpa ...

  4. spring data mongodb 配置遇到的几个问题

    一. mongodb 2.2版本以上的配置 spring.data.mongodb.uri = mongodb://newlook:newlook@192.168.0.109:27017/admin ...

  5. mongodb配置

    Mongodb1. 安装2. CRUD3. 索引4. 副本及(replica sets)5. 分片(sharding) nosql 简单数据模型 元数据和应用数据分离 弱一致性 优势: 避免不必要的复 ...

  6. Mac mongodb 配置安装

    简单总结就几条,比较简单配置mongodb. 1,首先下载安装包:百度云下载地址 2,下载之后解压到自己常放的工作目录下,然后开始配置一下你的Mac环境 vim ~/.bash_profile 添加m ...

  7. mongodb配置及简单示例

    安装 在官网下载安装 https://www.mongodb.com/ 配置 我的电脑—>右键属性—>左边列表中的高级程序设置—>环境变量 点击path 把你的mongodb文件路径 ...

  8. MongoDb 配置笔记

    安装: 官网:https://www.mongodb.org/ 按官方教程: http://docs.mongodb.org/master/tutorial/install-mongodb-on-re ...

  9. mongodb配置、启动、备份

    Mongodb: 启动: /usr/bin/mongod --config /data/mydata/mongodb/mongodb.conf 停止Mongodb: 方法一:$ mongod --sh ...

  10. jetty+mongodb 配置session外部数据库存储

    monbgodb简介 主页 http://www.mongodb.org/ oschina.net 介绍页 http://www.oschina.net/p/mongodb MongoDB是一个介于关 ...

随机推荐

  1. poj1182食物链,经典带权并查集

    动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种. 有人用两种 ...

  2. 大数相加a+b

    #include<stdio.h>#include<string.h>#define MAX 1000void Add(char *a,char *b,char *result ...

  3. Unity SLua 如何调用Unity中C#方法

    1.原理 就是通常在Lua框架中所说的,开放一个C#的web接口,或者叫做在Slua框架中注册函数. 2.作用 在Lua中调用C#中的方法,这个是在做热更新中很常用的一种方法,无论是slua,还是lu ...

  4. IE haslayout

    我们都知道浏览器有bug,而IE的bug似乎比大多数浏览器都多.IE的表现与其他浏览器不同的原因之一就是,显示引擎使用一个称为布局(layout)的内部概念.   因为布局是专门针对显示引擎内部工作方 ...

  5. React-Router 4 的新玩意儿

    上一个项目用的还是 2.6.1,转眼的功夫 4.0 都发布了,API 变化实在有点大,2.X那套东西不顶用了,老老实实重新看一遍文档,其中有几点需要注意的,拿出来说一说. 本文只讨论针对浏览器的应用, ...

  6. C#设置richtextbox某一段文本颜色

    假设 RichTextBox1 文本是"你好,我爱你中国",想要把中国变为红色,则 可以先找到中的位置是 7 :国的位置是8 设置 RichTextBox1.SelectionSt ...

  7. 每天一道Java题[7]

    题目 什么是REST原则,请解释RESTful架构,以及其设计思想? 解答 REST,全称为Representation State Transfer,是一种互联网软件的架构原则.凡是满足REST原则 ...

  8. HDU1829(种类并查集)

    ps:本来是想找个二分图判断的题来写,结果百度到这鬼题 Problem Description Background Professor Hopper is researching the sexua ...

  9. 最全DOS的CMD命令,程序员必会

    CMD命令:开始->运行->键入cmd或command(在命令行里可以看到系统版本.文件系统版本)1. appwiz.cpl:程序和功能 2. calc:启动计算器 3. certmgr. ...

  10. Nginx教程(二) Nginx虚拟主机配置

    Nginx教程(二) Nginx虚拟主机配置 1 虚拟主机管理 1.1 Nginx管理虚拟主机 虚拟主机使用的是特殊的软硬件技术,它把一台运行在因特网上的服务器主机分成一台台“虚拟”的主机,每台虚拟主 ...