MongoDB数据库配置文件与启动(二)

本文详细介绍了MongoDB数据库的配置文件`mongod.conf`的主要参数,包括系统日志设置、数据存储路径、网络监听端口和IP、进程管理以及安全性选项。重点关注了日志路径、数据库存储路径、日记启用、监听端口和允许IP访问的配置。同时提到了安全认证和副本集的启用,但指出这些将在后续讨论中详述。启动MongoDB数据库的命令为`service mongod start`。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文档介绍mongodb数据库的配置文件mongo.conf的参数
配置文件如下
# mongod.conf

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

# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
dbPath: /MongoDB/mongo
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
#security:
# authorization: enabled
# keyFile: /MongoDB/key/mongodb-keyfile
#

# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
port: 27017
bindIp: 0.0.0.0 # Listen to local interface only, comment to listen on all interfaces.


#security:

#operationProfiling:

#replication:
#replication:
# replSetName: Appex

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

需要使用的参数
1,systemLog:
destination: file #文件,默认
logAppend: true #输出日志,默认true,打开
path: /var/log/mongodb/mongod.log #日志路径
2,storage:
dbPath: /MongoDB/mongo #数据库存储数据路径,依生产环境而定
journal:
enabled: true #日记,默认true,存储引擎相关参数
3,net:
port: 27017 #监控端口
bindIp: 0.0.0.0 #允许IP访问,建议0.0.0.0全开,即允许所有人来访问,前提 是开启安全访问控制
4,processManagement:
fork: true # fork and run in background #开启进程模式
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo #时区
5,#security:
# authorization: enabled #密码认证,基于用户角色控制
# keyFile: /MongoDB/key/mongodb-keyfile #密钥认证,副本集之间的认证
PS:此参数默认关闭,打开配置后续讨论
6,#replication:
# replSetName: Appex #副本集名字
PS:副本集功能,后续讨论

启动命令:
service mongod start

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值