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
相关推荐
葫芦和十三5 小时前
图解 MongoDB 13|WiredTiger 存储引擎:B-tree、页和 checkpoint 三件套
后端·mongodb·agent
葫芦和十三6 小时前
图解 MongoDB 14|Cache 与淘汰:WiredTiger 的内存治理
后端·mongodb·面试
SelectDB10 小时前
阶跃星辰基于 SelectDB 构建 PB 级 Agent 可观测平台
大数据·数据库·aigc
这个DBA有点耶12 小时前
GROUP BY优化全解:如何写出既不丢数据又飞快的分组查询
数据库·mysql·架构
掉头发的王富贵15 小时前
【StarRocks】极限十分钟入门StarRocks
数据库·sql·mysql
Nturmoils15 小时前
WHERE 条件别凭习惯写,常用查询先跑一遍
数据库
Databend1 天前
在 AWS 中国峰会逛了一天,我在 Databend 展台看到了 Agent 数据基础设施的新思路
数据库·人工智能·agent
葫芦和十三2 天前
图解 MongoDB 12|索引与查询优化地图:一条主线,三个判断轴
后端·mongodb·agent
葫芦和十三2 天前
图解 MongoDB 11|慢查询排查闭环:从 Profile 到 explain 的分层路径
后端·mongodb·agent
葫芦和十三2 天前
图解 MongoDB 09|explain 再读:从 queryPlanner 到 executionStats
后端·mongodb·agent