安装
源码安装:
wget -c https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.19.tgztar xzf mongodb-linux-x86_64-3.4.19.tgzmv mongodb-linux-x86_64-3.4.19 /usr/local/mongodb
使用 vi/etc/profile.d/mongodb.sh 命令添加全局变量:
exportPATH=$PATH:/usr/local/mongodb/bin
配置
创建数据库文件夹mkdir -p /data/mongo创建日志目录mkdir -p /var/log/mongodb创建配置文件vi /etc/mongod.conf
配置文件
# mongod.conf# for documentation of all options, see:# http://docs.mongodb.org/manual/reference/configuration-options/# where to write logging data.systemLog:destination: filelogAppend: truepath: /var/log/mongodb/mongod.log# Where and how to store data.storage:dbPath: /data/mongojournal:enabled: true# engine:# mmapv1:# wiredTiger:# how the process runsprocessManagement:fork: true # fork and run in background# pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile# network interfacesnet:port: 17017bindIp: 0.0.0.0 # Listen to local interface only, comment to listen on all interfaces.#security:# authorization: enabled#operationProfiling:#replication:# replSetName:#sharding:## Enterprise-Only Options#auditLog:#snmp:
