mogodb的mgdb.conf配置文件不同版本下的配置

版本2.4+

dbpath=/usr/local/mongodb/data/db #数据文件存放目录
logpath=/usr/local/mongodb/log/mongodb.log #日志文件存放目录
port=27017 #端口,默认 27017,可以自定义
logappend=true #开启日志追加添加日志
fork=true #以守护程序的方式启用,即在后台运行
bind_ip=0.0.0.0 #本地监听 IP,0.0.0.0 表示本地所有 IP
auth=false #是否需要验证权限登录(用户名和密码)

版本4.0+

# mgdb.conf
# https://docs.mongodb.com/v4.0/reference/configuration-options/
# 4.0配置
storage:
    dbPath: "/usr/local/mongodb/data/db" #数据文件存放目录
systemLog:
    destination: file
    path: "/usr/local/mongodb/log/mongodb.log" 
net:
    bindIp: 0.0.0.0 #本地监听 IP,0.0.0.0 表示本地所有 IP
    port: 27017
processManagement:
     fork: true #以守护程序的方式启用, 即在后台运行
setParameter:
    enableLocalhostAuthBypass: false #是否需要验证权限登录(用户名和密码)

注:版本4.0+也支持版本2.4+的配置,Starting with MongoDB 3.6, MongoDB binaries, mongod and mongos, bind to localhost by default. From MongoDB versions 2.6 to 3.4, only the binaries from the official MongoDB RPM (Red Hat, CentOS, Fedora Linux, and derivatives) and DEB (Debian, Ubuntu, and derivatives) packages would bind to localhost by default.

猜你喜欢

转载自blog.csdn.net/qq_36912167/article/details/105388305