Configuration File Options

默认配置文件

  • 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

扫描二维码关注公众号,回复: 9056270 查看本文章

默认值:False

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

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

net.maxIncomingConnections

默认值:65536

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

发布了505 篇原创文章 · 获赞 41 · 访问量 21万+

猜你喜欢

转载自blog.csdn.net/kq1983/article/details/102931393