欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Configuration File Options

程序员文章站 2022-06-13 20:39:23
...

默认配置文件

  • On Linux, a default /etc/mongod.conf configuration file is included when using a package manager to install MongoDB.
  • On Windows, a default <install directory>/bin/mongod.cfg configuration file is included during the installation.
  • On macOS, a default /usr/local/etc/mongod.conf configuration file is included when installing from MongoDB’s official Homebrew tap.

 

指定配置文件启动

# --config
mongod --config /etc/mongod.conf
mongos --config /etc/mongos.conf

# -f 
mongod -f /etc/mongod.conf
mongos -f /etc/mongos.conf

 

# net 属性
net:
   port: <int>
   bindIp: <string>
   bindIpAll: <boolean>
   maxIncomingConnections: <int>
   wireObjectCheck: <boolean>
   ipv6: <boolean>

net.port:
27017 for mongod (if not a shard member or a config server member) or mongos instance
27018 if mongod is a shard member
27019 if mongod is a config server member
The TCP port on which the MongoDB instance listens for client connections.

net.bindIp

默认localhost

要绑定到多个地址,输入用逗号分隔的值的列表

localhost, 2001:0DB8:e132:ba26:0d5c:2774:e7f9:d513

注意: ipv4的ip除了127.0.0.1和0.0.0.0之外,指定其他ip都会报错的

net.bindIpAll

默认值:False

如果为true,则mongosor mongod实例绑定到所有IPv4地址(即0.0.0.0)

net.bindIp并且net.bindIpAll是互斥的。也就是说,您可以指定一个,但不能两个都指定

net.maxIncomingConnections

默认值:65536

mongos或mongod将接受的最大同时连接数。如果此设置高于操作系统的配置的最大连接跟踪阈值,则此设置无效。