[MongoDB] - mongod.exe参数详解

  mongod.exe是启动mongodb的命令,我们可以通过mongod --help来查看帮助文档。下面是各个参数的对应中文解释。<基于Mongo3.0.5>

通用参数选项

-h/--help  显示帮助信息

--version  显示当前mongo的版本信息

-f/--config arg  使用配置文件指定启动参数

-v/--verbose  使用冗长的信息,一般不用。

--quiet  安静的输出

--port arg  指定端口号,默认为27017

--bind_ip arg  指定监听的ip地址,使用逗号分隔ip,比如ip1,ip2。默认情况下监听搜索ip,即0.0.0.0。

--ipv6  启动ipv6的支持,默认不支持ipv6的访问。

--maxConns arg  指定最大的并发连接数,默认情况为1000000。

--logpath arg  指定日志输出文件,默认情况是输出到控制台,必须是一个文件,不能是目录。

--logappend  更改日志输出到文件的方式为追加模式,默认情况为覆盖。

--logRotate arg  设置日志轮询行为,参数只能是rename或者是reopen。

--timeStampFormat arg  设置希望的log日期格式,参数必须是iso8601-utc或者iso8601-local两者之一。

--pidfilepath arg  设置pid的存储文件,默认不设置。如果不设置,那么不保存pid。

--keyFile arg  如果开启集群的验证,那么指定私钥文件位置

--setParameter arg  设置参数

--httpinterface  启用http界面

--clusterAuthMode arg  集群验证类型

--auth  使用安全模式启动MongoDB,启用后需要输入用户名和密码,默认情况下不是启用的。

--noauth  不是安全模式启动

--jsonp  允许JSONP通过http访问(这个会存在安全隐患)

--rest  开启简答的api

--slowms arg  是否是否启动概要文件和日志输出

--profile arg  0=off,1=slow,2=all.

--cpu  定期的显示cpu和io的使用率

--sysinfo  打印诊断相关的系统信息

--noIndexBuildRetry  不重构

--noscripting  关闭scripting引擎

--notablescan  不允许全collection扫描

windows服务控制管理器参数

--install  注册windows服务

--remove  移除window服务

--reinstall  重新注册windows服务

--serviceName arg  windows服务名称

--serviceDisplayName arg  windows服务显示命令

--serviceDescription arg  widnows服务描述信息

--serviceUser arg  服务执行用户名

--servicePassword arg  服务执行用户密码

复制参数

--oplogSize arg  用于复制op日志的大小,单位为MB。默认情况为磁盘空间的5%,当然如果允许越高越好。

主从配置参数(现在使用replicate参数替代)

--master  master节点

--slave  slave节点

--source arg  当节点为slave节点的时候,指定master节点的连接(server_ip:port)

--only arg  当节点为slave节点的时候,指定一个单独的数据库进行主从复制。

--slavedelay arg  当slave请求master的op操作时候,指定延期时间,单位秒。

--autoresync  如果slave节点的数据落后master数据10s,自动同步。这个要求--oplogSize比较大。默认是10分钟至少更新一次。

副本集参数

--replSet arg  副本集名称,所有的副本集必须有相同的名称。

--replIndexPrefetch arg  指定指数预期行为

分片参数

--configsvr  声明这是一个集群的config服务,默认端口27019,默认目录/data/configdb

--shardsvr  声明这是一个集群的分片,默认端口27018

SSL参数

--sslOnNormalPorts  使用ssl的端口号
--sslMode arg  设置ssl的操作模式(disabled|allowSSL|preferSSL|requireSSL)
--sslPEMKeyFile arg  设置ssl的PEM文件
--sslPEMKeyPassword arg  设置PEM文件密码
--sslClusterFile arg  内部的ssl验证key文件
--sslClusterPassword arg  内部的校验密码
--sslCAFile arg  xx
--sslCRLFile arg xx
--sslWeakCertificateValidation 允许连接
--sslAllowConnectionsWithoutCertificates xxx
--sslAllowInvalidHostnames xxx
--sslAllowInvalidCertificates xxx
--sslFIPSMode xxx

存储参数

--storageEngine arg 设置存储引擎

--dbpath arg  设置数据存储目录,默认为\data\db,C:\data\db\

--directoryperdb  每个数据库保存到不同的目录

--noprealloc  不允许disrectoryperdb

--nssize arg (=16)  .ns文件的大小对于一个新的数据库,单位MB

--quota  限制每个数据库的文件个数,默认为8

--quotaFiles arg  每个数据库文件的个数,当启用--quota的时候有用,默认情况为8

--smallfiles  使用较小的文件

--syncdelay arg  同步间隔时间,0表示不同步。单位秒。

--upgrade  如果需要,升级

--repair  修复所有的数据库

--repairpath arg  指定要修复的数据库路径

--journal  enable journaling

--nojournal  

--journalOptions arg

--journalCommitInterval arg

WiredTiger options:

--wiredTigerCacheSizeGB arg maximum amount of memory to allocate for cache; defaults to 1/2 of physical RAM

--wiredTigerStatisticsLogDelaySecs arg (=0) seconds to wait between each write to a statistics file in the dbpath; 0 means do not log statistics

--wiredTigerJournalCompressor arg (=snappy) use a compressor for log records [none|snappy|zlib]

--wiredTigerDirectoryForIndexes Put indexes and data in different directories

--wiredTigerCollectionBlockCompressor arg (=snappy) block compression algorithm for collection data [none|snappy|zlib]

--wiredTigerIndexPrefixCompression arg (=1) use prefix compression on row-store leaf pages

 

至此,mongod的参数基本上描述完了,主要描述一下常用的参数,其他参数没有描述。hahah

posted @ 2015-08-21 16:19  liuming_1992  阅读(1505)  评论(0编辑  收藏  举报