mongoDb中文社区:https://docs.mongoing.com/
mongodb下载: https://www.mongodb.com/try/download/community
我们下载tar压缩包,下载5.0版本的
下载压缩包后解压,启动mongo可以通过直接命令参数启动:
tar -zxf mongodb-linux-x86_64-rhel70-5.0.8.tgz
mongod --dbpath data/db --logpath data/log/mongodb.log --bind_ip 0.0.0.0 --fork
或者指定配置文件启动:
./mongod -f mongodb.cfg 或者 mongod --config mongodb.cfg
关闭
mongod -f mongodb.cfg --shutdown
mongodb.cfg文件:
systemLog:
destination: file
path: ./log/mongod.log
logAppend: true
storage:
dbPath: ./data
engine: wiredTiger #存储引擎
journal: #是否启用journal日志
enabled: true
net:
bindIp: 0.0.0.0
port: 27017
processManagement:
fork: true
配置环境变量:
vim /etc/profile
末尾添加:
export MONGODB_HOME=/home/admin/mongDB
export PATH=$PATH:$MONGODB_HOME/binsource /etc/profile