前言

最新版本支持yaml格式的配置文件,只支持空格,不能使用tab

详细配置说明

  1. #系统日志配置
  2. systemLog:
  3. destination: file
  4. path: /var/log/mongodb/mongod.log
  5. logAppend: true
  6. #quiet模式运行,建议设置为false,方便排查错误
  7. quiet: false
  8.  
  9. #进程管理
  10. processManagement:
  11. #进程后台运行
  12. fork: true
  13. #进程pid文件
  14. pidFilePath: /var/log/mongodb/mongod.pid
  15.  
  16. #网络配置
  17. net:
  18. #监听端口
  19. port: 27017
  20. #监听网卡 多个使用英文逗号隔开
  21. bindIp: 127.0.0.1
  22. #最大并发连接数 默认65535
  23. maxIncomingConnections: 65535
  24. #验证客户端传过来的数据,文档嵌套多时,对性能会有些影响
  25. wireObjectCheck: true
  26. #是否启用ipv6,默认不启用
  27. ipv6: false
  28. unixDomainSocket:
  29. #是否启用socket监听 默认true
  30. enabled: true
  31. #socket保存目录,默认/tmp
  32. pathPrefix: /var/log/mongodb
  33. #socket文件权限,默认0700
  34. filePermissions: 0700
  35. http:
  36. #是否启用http服务,默认false,安全考虑线上环境要关闭
  37. enabled: false
  38. #是否启用http jsonp,默认false,即使http.enabled为false,只要此项为true,一样可以访问,安全考虑线上环境要关闭
  39. JSONPEnabled: false
  40. #是否启用rest api接口,默认false,安全考虑线上环境要关闭
  41. RESTInterfaceEnabled: false
  42. ssl:
  43. #type:string
  44. #是否启用加密
  45. #可选值1 disabled:禁用
  46. #可选值2 allowSSL:优先使用非加密,但是服务器支持加密
  47. #可选值3 preferSSL:优先使用加密,但是服务器也支持非加密
  48. #可选值4 requireSSL:只支持加密
  49.  
  50. mode: disabled
  51.  
  52. #type:string
  53. #包含TLS/SSL certificate and key的文件路径
  54. #包含公钥和私钥
  55.  
  56. PEMKeyFile: /var/log/mongodb/mongodb.pem
  57.  
  58. #type:string
  59. #私钥加密时的密码
  60.  
  61. PEMKeyPassword: password
  62.  
  63. #type:string
  64. #The .pem file that contains the x.509 certificate-key file for membership authentication for the cluster or replica set.
  65. #不存在会使用PEMKeyFile
  66.  
  67. clusterFile: /var/log/mongodb/cluster.pem
  68.  
  69. #type:string
  70. #The password to de-crypt the x.509 certificate-key file specified with --sslClusterFile
  71.  
  72. clusterPassword: password
  73.  
  74. #type:string
  75. #The .pem file that contains the root certificate chain from the Certificate Authority.
  76.  
  77. CAFile:
  78.  
  79. #type:string
  80. #The the .pem file that contains the Certificate Revocation List.
  81.  
  82. CRLFile:
  83.  
  84. #type:boolean
  85. #Enable or disable the requirement for TLS/SSL certificate validation that CAFile enables
  86.  
  87. allowConnectionsWithoutCertificates: true
  88.  
  89. #type:boolean
  90. #Enable or disable the validation checks for TLS/SSL certificates on other servers in the cluster and allows the use of invalid certificates.
  91.  
  92. allowInvalidCertificates: false
  93.  
  94. #type:boolean
  95. #是否允许无效的域名,当为true时,mongod不检查证书里面域名的有效性,即使域名不匹配,mongod同样允许连接mongodb实例
  96.  
  97. allowInvalidHostnames: false
  98.  
  99. #type:string
  100. #禁用加密协议版本,多个使用英文逗号隔开
  101. #可设置的值TLS1_0, TLS1_1, and TLS1_2
  102.  
  103. disabledProtocols:
  104.  
  105. #type:string
  106. #Enable or disable the use of the FIPS mode of the installed OpenSSL library for the mongos or mongod.
  107.  
  108. FIPSMode: false
  109. compression:
  110. #是否启用数据压缩
  111. compressors: snappy
  112.  
  113. #安全配置
  114. security:
  115. #type:string
  116. #密钥路径,副本集和分片集群节点间授权时使用的密钥
  117. keyFile:
  118.  
  119. #type:string
  120. #集群授权模式,默认keyFile,值列表:keyFile,sendKeyFile,sendX509,x509
  121. clusterAuthMode: keyFile
  122.  
  123. #type:string
  124. #是否开启数据库访问RBAC权限控制,默认:disabled,仅对mongod命令有效
  125. authorization: enabled
  126.  
  127. #type:boolean
  128. #Allows the mongod or mongos to accept and create authenticated and non-authenticated connections to and from other mongod and mongos instances in the deployment.
  129. transitionToAuth: false
  130.  
  131. #type:boolean
  132. #是否开启服端js执行,默认true,如果未开启$where,group,mapreduce都不能使用
  133. javascriptEnabled: true
  134.  
  135. #type:boolean
  136. #写日志之前是否编辑客户端日志数据,去除日志中的敏感数据,仅企业版支持
  137. redactClientLogData: true
  138.  
  139. #key管理配置
  140. security:
  141. #type:boolean
  142. #WiredTiger存储引擎是否启用加密,默认false,仅企业版支持
  143. enableEncryption: false
  144.  
  145. #type:string
  146. #加密模式,默认AES256-CBC,仅企业版支持
  147. encryptionCipherMode: AES256-CBC
  148.  
  149. #type:string
  150. #密钥文件路径,仅企业版支持
  151. encryptionKeyFile: /var/log/mongodb/encKeyFile
  152.  
  153. #kmip key server,仅企业版支持
  154. kmip:
  155. #type:string
  156. #Unique KMIP identifier for an existing key within the KMIP server.
  157. keyIdentifier:
  158.  
  159. #type:boolean
  160. #If true, rotate the master key and re-encrypt the internal keystore
  161. rotateMasterKey: false
  162.  
  163. #type:string
  164. #Hostname or IP address of key management solution running a KMIP server.
  165. serverName:
  166.  
  167. #type:int
  168. #Port number the KMIP server is listening on
  169. port: 5696
  170.  
  171. #type:string
  172. #String containing the path to the client certificate used for authenticating MongoDB to the KMIP server.
  173. clientCertificateFile:
  174.  
  175. #type:string
  176. #The password to decrypt the client certificate, used to authenticate MongoDB to the KMIP server.
  177. clientCertificatePassword:
  178.  
  179. #type:string
  180. #Path to CA File. Used for validating secure client connection to KMIP server.
  181. serverCAFile:
  182.  
  183. #sasal配置
  184. security:
  185. sasl:
  186. hostName: "" #A fully qualified server domain name for the purpose of configuring SASL and Kerberos authentication.
  187. serviceName: "" #Registered name of the service using SASL.
  188. saslauthdSocketPath: "" #The path to the UNIX domain socket file for saslauthd
  189.  
  190. #setParameter配置
  191. setParameter:
  192. enableLocalhostAuthBypass: false
  193.  
  194. #存储配置
  195. storage:
  196. #type:string
  197. #数据库数据存储目录,默认/data/db
  198. dbPath:
  199.  
  200. #type:boolean
  201. #启动时是否尝试重建索引,默认true
  202. indexBuildRetry: true
  203.  
  204. #type:string
  205. #修复数据时使用的目录,默认是:A _tmp_repairDatabase_<num> directory under the dbPath
  206. repairPath:
  207.  
  208. #journal日志
  209. journal:
  210. #type:boolean
  211. #Enable or disable the durability journal to ensure data files remain valid and recoverable. Default: true on 64-bit systems, false on 32-bit systems
  212. enabled: true
  213.  
  214. #type:int
  215. #日志同步间隔,Values can range from 1 to 500 milliseconds.
  216. commitIntervalMs: 100
  217.  
  218. #type:boolean
  219. #是否开启一数据库一目录,默认是false
  220. directoryPerDB: false
  221.  
  222. #type:int
  223. #数据落地时间间隔,默认为60秒,不能设置为0,一般使用默认值即可
  224. syncPeriodSecs: 60
  225.  
  226. #type:string
  227. ##存储引擎,默认wiredTiger,可选值 mmapv1,wiredTiger,inMemory
  228. engine: wiredTiger
  229.  
  230. #mmapv1存储引擎配置
  231. storage:
  232. mmapv1:
  233. #type:boolean
  234. #默认true,Enables or disables the preallocation of data files.
  235. preallocDataFiles: true
  236.  
  237. #type:int
  238. #默认16M The default size for namespace files, which are files that end in .ns.
  239. nsSize: 16
  240.  
  241. #配额
  242. quota:
  243. #type:boolean
  244. #是否强制限制每个数据库数据文件数量限制,数量限制由maxFilesPerDB选项指定,默认为false
  245. enforced: false
  246.  
  247. #type:int
  248. #单个实例最大数据文件数量,需要先开启enforced配置,默认8
  249. maxFilesPerDB: 8
  250.  
  251. #type:boolean
  252. #小文件存储,默认为false,journal文件也会影响,适用场景:多数据库且数据量不大
  253. smallFiles: false
  254. journal:
  255. #type:boolean
  256. #journal调试标志,用于测试功能,一般情况下不使用,系统异常关机会影响数据的完整性
  257. debugFlags: 0
  258.  
  259. #type:int
  260. #version >= 3.2版本不建议使用
  261. commitIntervalMs: 60
  262.  
  263. #wiredTiger存储引擎配置
  264. storage:
  265. wiredTiger:
  266. engineConfig:
  267. #type:float
  268. #单个实例可用的数据缓存内存大小,version >= 3.4默认:50% of RAM minus 1 GB, or 256 MB. Values can range from 256MB to 10TB and can be a float.
  269. cacheSizeGB: 0.25
  270.  
  271. #type:string
  272. #WiredTiger journal数据压缩格式,默认snappy,可用的压缩类型: none, snappy, zlib
  273. journalCompressor: snappy
  274.  
  275. #type:boolean
  276. #索引文件分目录存储,默认false,version >= 3.0后版本可用
  277. directoryForIndexes: false
  278. collectionConfig:
  279. #type:string
  280. #块数据压缩格式,默认snappy,可用的压缩类型:none, snappy, zlib
  281. blockCompressor: snappy
  282. indexConfig:
  283. #type:boolean
  284. #是否开启索引prefix compression,默认true
  285. prefixCompression: true #是否开启索引prefix compression,默认true
  286.  
  287. #operationProfiling操作性能分析
  288. operationProfiling:
  289. #type:int
  290. #慢查询时间单位毫秒,默认100,如果开启了profile,日志会保存到system.profile集合中
  291. slowOpThresholdMs: 100
  292.  
  293. #type:string
  294. #性能分析模式,开启会影响性能,谨慎操作。默认off.
  295. #可选值1:off: Off. No profiling.
  296. #可选值2: slowOp:On. Only includes slow operations.
  297. #可选值3: all:On. Includes all operations.
  298. mode: off
  299.  
  300. #replication复制配置
  301. replication:
  302. #type:int
  303. #数字类型(单位M) replication op log 大小,64位系统默认为可用磁盘的5%
  304. oplogSizeMB: 512
  305.  
  306. #type:string
  307. #所属replica set集群名称
  308. replSetName:
  309.  
  310. #type:string
  311. #The indexes that secondary members of a replica set load into memory before applying operations from the oplog. 默认all
  312. #可选值1 none:Secondaries do not load indexes into memory.
  313. #可选值2 all:Secondaries load all indexes related to an operation.
  314. #可选值3 _id_only:Secondaries load no additional indexes into memory beyond the already existing _id index.
  315. secondaryIndexPrefetch: all
  316.  
  317. #type:boolean
  318. #默认false version >= 3.2版本可用 Enables read concern level of "majority".
  319. enableMajorityReadConcern:false
  320.  
  321. #分片配置
  322. sharding:
  323. #type:string
  324. #分片集群中的担当的角色
  325. #可选值1 configsvr:配置svr
  326. #可选值2 shardsvr: 数据svr
  327. clusterRole: shardsvr
  328. #type:boolean
  329. #默认false
  330. #During chunk migration, a shard does not save documents migrated from the shard.
  331. archiveMovedChunks: false
  332.  
  333. #auditLog配置
  334. #仅企业版支付
  335. auditLog:
  336. #type:string
  337. #审计日志保存方式
  338. #可选值1 syslog:Output the audit events to syslog in JSON format.
  339. #可选值2 console:Output the audit events to stdout in JSON format.
  340. #可选值3 file:Output the audit events to the file specified in --auditPath in the format specified in --auditFormat.
  341. destination: syslog
  342. #type:string
  343. #日志格式
  344. #可选值1:JSON
  345. #可选值2:BSON
  346. format: JSON
  347. #type:string
  348. #日志文件路径,相对路经和绝对路径都支持
  349. path: path/audit.log
  350. #type:string representation of a document
  351. #The filter to limit the types of operations the audit system records.
  352. #内容格式:{ <field1>: <expression1>, ... }
  353. filter: {}
  354.  
  355. #snmp(简单网络管理协议)配置
  356. snmp:
  357. #type:boolean
  358. #When snmp.subagent is true, SNMP runs as a subagent. For more information, see Monitor MongoDB With SNMP on Linux.
  359. subagent:false
  360. #type:boolean
  361. #When snmp.master is true, SNMP runs as a master. For more information, see Monitor MongoDB With SNMP on Linux.
  362. master:false
  363.  
  364. #Text Search配置
  365. basisTech:
  366. #type:string
  367. #v3.2版本加入
  368. #仅企业版支持
  369. #Specify the path to the root directory of the Basis Technology Rosette Linguistics Platform installation to support additional languages for text search operations.
  370. rootDirectory:/path/
  371.  
  372. #mongos-only Options
  373. replication:
  374. #type:integer
  375. #The ping time, in milliseconds, that mongos uses to determine which secondary replica set members to pass read operations from clients.
  376. #默认值为15毫秒
  377. localPingThresholdMs:15
  378. sharding:
  379. #type:string
  380. #The configuration servers for the sharded cluster.
  381. #建议使用replica set
  382. #值格式:<configReplSetName>/cfg1.example.net:27017, cfg2.example.net:27017,...
  383. configDB:

  

参考文档

【1】服务器配置文档

https://docs.mongodb.com/manual/reference/configuration-options/

【2】服务器参数

https://docs.mongodb.com/manual/reference/parameters/

mongodb之配置的更多相关文章

  1. MongoDB的配置、启动、关闭

    MongoDB 是一个基于分布式文件存储的数据库.由 C++ 语言编写.旨在为 WEB 应用提供可扩展的高性能数据存储解决方案. MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系 ...

  2. mongoDB 安装配置

    1. 配置文件: 建立配置文件 :mongodb.conf dbpath=D:\mongoDb\data\db #配置数据库目录路径,预先手动创建db目录 logpath=D:\mongoDb\dat ...

  3. MongoDB启动配置等

    目录: 一.mongoDB 启动配置 二.导出,导入,运行时备份 三.Fsync锁,数据修复 四.用户管理,安全认证 一.启动项 mongod --help C:\Windows\system32&g ...

  4. MongoDB C Driver and APIinstances linux MongoDB安装配置

    <一,linux平台MongoDB安装配置>在这我们使用的Centos6 yum部署的,你想搞编译,自个干!

  5. mongodb系列之--mongodb 主从配置与说明

    一.为什么要配置mongodb的主从: 1.做主从,可以说是做数据的备份,有利于故障的恢复 2.做主从,可以做到读写分离,主节点负责写操作,从节点负责读操作,这样就把读写压力分开,保证系统的稳定性. ...

  6. MongoDB安装配置教程

    数据是每一前端人员必定接触的一样,所有的数据都是后端来编写,如果自己想练习项目,却没有数据,而是写一些假数据,去编写,或者通过json-server搭建一个数据,今天我们就通过MongoDB来搭建一个 ...

  7. windows上MongoDB远程访问配置

    今天用另一台机器上的MongoDB,但是使用本地连接时,没问题 换成IP地址时,出现 解决的方法,修改配置文件 systemLog: destination: file path: d:/Mongod ...

  8. mongodb数据库环境配置

    数据是每一前端人员必定接触的一样,所有的数据都是后端来编写,如果自己想练习项目,却没有数据,而是写一些假数据,去编写,或者通过json-server搭建一个数据,今天我们就通过MongoDB来搭建一个 ...

  9. python爬虫-MongoDB安装配置

    MongoDB安装配置: 在安装配置MongoDB的过程中遇到了很多问题,现在重新梳理一遍安装流程.遇到的问题及其解决方法 系统版本:Windows 10 MongoDB版本:4.2.1 1.下载地址 ...

  10. mongodb全套配置

    1,下载&安装 MongoDB 提供了centos yum安装方式. 参考:http://docs.mongodb.org/manual/tutorial/install-mongodb-on ...

随机推荐

  1. DOM对象,控制HTML元素(1)

    1:getElementsByName(name)方法 它是通过元素的name属性来查询元素,而不是通过id属性.getElementById()方法是通过元素的id属性来获取元素的. 注意: 该方法 ...

  2. RocketMQ(1)--helloworld

    双Master方式: 服务器环境 序号 IP 角色 模式 1 192.168.32.135 nameServer1,brokerServer1  Master1 2 192.168.32.136 na ...

  3. scrapy 框架持久化存储

    1.基于终端的持久化存储 保证爬虫文件的parse方法中有可迭代类型对象(通常为列表或字典)的返回,该返回值可以通过终端指令的形式写入指定格式的文件中进行持久化操作. # 执行输出指定格式进行存储:将 ...

  4. [转]自适应网页设计(Responsive Web Design)

    本文转自:http://www.ruanyifeng.com/blog/2012/05/responsive_web_design.html 作者: 阮一峰 日期: 2012年5月 1日 随着3G的普 ...

  5. Unity Sprite Packer 问题集合

    介绍 今天突发奇想用了下sprite packer 这个功能,基本用法网上教程一堆一堆的,这里就不赘述了. 在使用sprite packer过程中遇到一些问题,然后各种百度不到答案,最后和谐上网找到了 ...

  6. Android 自己搭建一个直播系统吧

    服务端用 SRS(Simple Rtmp Server),在这里下载simple-rtmp-server需要Linux系统最好是Ubuntu,装个Ubuntu虚拟机就行了在Linux里,解压缩SRS ...

  7. html5——渐变

    线性渐变 <style> div { width: 700px; height: 100px; /*方向:从右向左*/ /*起始颜色:黄色*/ /*终止颜色:绿色*/ background ...

  8. CSS——样式初始化

    腾讯: body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,fieldset,legend,input,textarea,select{margin:0;p ...

  9. SQL基本操作——表的创建

    通过代码方式创建数据库 create database MyDatabaseNew on primary ( --名字 name='MyDatabaseNew_data', --路径 filename ...

  10. [Windows Server 2003] 还原SQL Server数据库

    ★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:SQL Ser ...