安装

予早 2026-04-30 23:53:28
Categories: Tags:

安装

产品生态

MongoDB生态中有很多产品。

  1. server
  2. database tool
  3. shell
  4. compass

当然分不同平台和不同发布版(社区版和企业版)

单体服务

mkdir -p ./single/data/db
mkdir -p ./single/log
vi ./single/mongod.yaml
systemLog:
    #MongoDB发送所有日志输出的目标指定为文件
    # #The path of the log file to which mongod or mongos should send all diagnostic logging information
    destination: file
    #mongod或mongos应向其发送所有诊断日志记录信息的日志文件的路径
    path: "/mongodb/single/log/mongod.log"
    #当mongos或mongod实例重新启动时,mongos或mongod会将新条目附加到现有日志文件的末尾。
    logAppend: true
storage:
    #mongod实例存储其数据的目录。storage.dbPath设置仅适用于mongod。
    ##The directory where the mongod instance stores its data.Default Value is "/data/db".
    dbPath: "/mongodb/single/data/db"
    journal:
    #启用或禁用持久性日志以确保数据文件保持有效和可恢复。
    enabled: true
    processManagement:
    #启用在后台运行mongos或mongod进程的守护进程模式。
    fork: true
net:
    #服务实例绑定的IP,默认是localhost
    bindIp: localhost,192.168.0.2
    #bindIp
    #绑定的端口,默认是27017
    port: 27017
systemLog:
    destination: file
    path: "/usr/local/mongodb/single/log/mongod.log"
    logAppend: true
storage:
    dbPath: "/usr/local/mongodb/single/data/db"
    journal:
 enabled: true
processManagement:
    fork: true
net:
    bindIp: localhost,192.168.0.2
    port: 27017
/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/single/mongod.yaml