MongoDB

最后更新于:2022-04-02 03:59:21

[TOC] ## 概述 ## 安装 ### yum vim `/etc/yum.repos.d/mongodb-org-4.2.repo` ``` [mongodb-org-4.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc ``` ``` sudo yum install -y mongodb-org ``` ### centos 在 package 是选择 TGZ 模式 是编译好的压缩包 ### mac #### 安装 配置文件默认在 /usr/local/etc 下的 mongod.conf ``` sudo brew install mongodb ``` #### 启动 ``` //启动 mongod --config=/usr/local/etc/mongod.conf //启动 shell mongo ``` ## window https://www.mongodb.com/download-center/community 创建配置文件如下配置信息 `mongod.cfg` ``` systemLog: destination: file path: D:\Program Files (x86)\mongodb-win32-x86_64-2012plus-4.2.2\data\log\mongod.log storage: dbPath: D:\Program Files (x86)\mongodb-win32-x86_64-2012plus-4.2.2\data\ net: bindIp: 0.0.0.0 port: 27017 maxIncomingConnections: 56635 setParameter: enableLocalhostAuthBypass: false ``` 做成服务器 **管理员**cmd ``` mongod.exe --config "D:\Program Files (x86)\mongodb-win32-x86_64-2012plus-4.2.2\bin\mongod.cfg" --install net start mongodb ```
';