mongodb源码安装

下载包

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.4.6.tgz
tar -zxvf mongodb-linux-x86_64-rhel80-4.4.6.tgz
mv mongodb-linux-x86_64-rhel80-4.4.6.tgz /usr/local/mongodb

创建目录

cd /usr/local/mongodb
mkdir data
mkdir log

配置环境变量/etc/profile:

export MONGODB_HOME=/usr/local/mongodb  
export PATH=$PATH:$MONGODB_HOME/bin 

配置文件

cd bin
nano mongodb.conf
##编写以下内容:
systemLog:
  destination: file
  logAppend: true
  path: /usr/local/mongodb/logs/mongodb.log
  
net:
  port: 27017
  bindIp: 0.0.0.0
  maxIncomingConnections: 10000


storage:
    dbPath: /usr/local/mongodb/data/db
    journal:
        enabled: true
    wiredTiger:
        engineConfig:
            cacheSizeGB: 1
systemLog:
  destination: file
  logAppend: true
  path: /usr/local/mongodb/logs/mongodb.log

processManagement:
    fork: true
security:
    authorization: enabled

net:
  port: 27017
  bindIp: 0.0.0.0
  maxIncomingConnections: 10000

启动停止:

./mongod -f ./mongo.conf
sudo ./mongod -f ./mongodb.conf --shutdown

其他工具,如导入导出

https://fastdl.mongodb.org/tools/db/mongodb-database-tools-rhel70-x86_64-100.3.1.tgz
#解压,把bin里面的全部放到mongodb/bin下边即可使用
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容