@H_301_0@一、下载mongodb3.4
# cd /usr/local/src
# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.1.tgz
# tar fxz mongodb-linux-x86_64-3.4.1.tgz
# mv mongodb-linux-x86_64-3.4.1 ../
# mv mongodb-linux-x86_64-3.4.1 mongodb
二、创建目录
# cd /usr/local/mongodb
# mkdir -p mongodata/db
# mkdir -p mongodata/logs
三、修改配置文件
# cd mongodata/
# vim mongodb.conf
systemLog:
destination: file
path: /usr/local/mongodb/mongodata/logs/mongod.log
logAppend: true
processManagement:
fork: true
pidFilePath: "/usr/local/mongodb/mongodata/mongod.pid"
net:
port: 27017
http:
enabled: true
storage:
dbPath: "/usr/local/mongodb/mongodata/db"
engine: wiredTiger
wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
journal:
enabled: true
directoryPerDB: true
security:
authorization: disabled
四、启动
# ./bin/mongod --config /usr/local/mongodb/mongodata/mongodb.conf
# vim /etc/sysconfig/iptables #开启27017端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 28017 -j ACCEPT
# service iptables restart
# netstat -anlp |grep mongod
# mongo --port 27017
@H_301_0@在浏览器中输入地址访问http://192.168.1.234:28017/
五、参考
http://noodle.blog.51cto.com/2925423/1747961
@H_301_0@http://blog.csdn.net/freewebsys/article/details/45368809