MongoDB快速启动

两种方法:
方式 1 :命令行参数方式启动服务
在 bin 目录中打开命令行提示符,输入如下命令: (mongod --dbpath=..\data\db)

复制代码
mongod --dbpath=..\data\db

方式 2 :配置文件方式启动服务
在解压目录中新建 config 文件夹,该文件夹中新建配置文件 mongod.conf ,内如参考如下:

XML 复制代码
storage:
  #The directory where the mongod instance stores its data.Default Value is "\data\db" on Windows.
  dbPath: D:\02_Server\DBServer\mongodb-win32-x86_64-2008plus-ssl-4.0.1\data 

详细配置项内容可以参考官方文档: https://docs.mongodb.com/manual/reference/configuration-options/
【注意】
1 )配置文件中如果使用双引号,比如路径地址,自动会将双引号的内容转义。如果不转义,则会报错:
error-parsing-yaml-config-file-yaml-cpp-error-at-line-3-column-15-unknown-escape-character-d
解决:
a. 对 \ 换成 / 或 \\
b. 如果路径中没有空格,则无需加引号。
2 )配置文件中不能以 Tab 分割字段 解决:
将其转换成空格。
启动方式:
更多参数配置:

XML 复制代码
systemLog:
    destination: file
#The path of the log file to which mongod or mongos should send all diagnostic logging information
    path: "D:/02_Server/DBServer/mongodb-win32-x86_64-2008plus-ssl-4.0.1/log/mongod.log"
    logAppend: true
storage:
    journal:
        enabled: true
#The directory where the mongod instance stores its data.Default Value is "/data/db".    
        dbPath: "D:/02_Server/DBServer/mongodb-win32-x86_64-2008plus-ssl-4.0.1/data"
    net:
#bindIp: 127.0.0.1
        port: 27017
    setParameter:
        enableLocalhostAuthBypass: false
相关推荐
RestCloud1 天前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud1 天前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence1 天前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库
DemonAvenger1 天前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
AAA修煤气灶刘哥2 天前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql
RestCloud2 天前
揭秘 CDC 技术:让数据库同步快人一步
数据库·api
得物技术2 天前
MySQL单表为何别超2000万行?揭秘B+树与16KB页的生死博弈|得物技术
数据库·后端·mysql
可涵不会debug2 天前
【IoTDB】时序数据库选型指南:工业大数据场景下的技术突围
数据库·时序数据库
ByteBlossom2 天前
MySQL 面试场景题之如何处理 BLOB 和CLOB 数据类型?
数据库·mysql·面试
麦兜*2 天前
MongoDB Atlas 云数据库实战:从零搭建全球多节点集群
java·数据库·spring boot·mongodb·spring·spring cloud