mongodb多实例启动和开启用户验证

Table of Contents

在这里,我不废话,直接给出mongodb配置文件模板

# mongod.conf

# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: mongodb数据库的路径(自己可以随便取,只要不与默认的一样就行了)
  journal:
  enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: mongodb日志路径(自己可以随便取,只要不与默认的一样就行了)

# network interfaces
net:
  port: 端口0~65536(不常用的端口可以随便取,不可以和默认的一样)
  bindIp: 0.0.0.0


# how the process runs
processManagement:
  # timeZoneInfo: /usr/share/zoneinfo
  fork: false
#开启用户认证
security:
  authorization: enabled

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp: