mongodb搭建

基础启停命令

# 配置文件如果没有fork=true,则需要--fork才能在后台启动
# 启动 .
/bin/mongod --fork --config ./conf/mongo.conf
./bin/mongod --config ./conf/mongodb.conf
./bin/mongod -f ./conf/mongodb.conf
# 关闭
./bin/mongod -shutdown -dbpath=./data

下载 mongodb 据库库

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz

 创建配置文件

cd {mondb安装目录}
mkdir log data conf
mongodb_dir=`pwd`
cat << EOF > conf/mongodb.conf
dbpath=$mongodb_dir/data
logpath=$mongodb_dir/log/mongodb.log
logappend=true
journal=true
quiet=true
port=27017
bind_ip=0.0.0.0
fork=true
EOF


作者:Outsrkem
出处:https://www.cnblogs.com/outsrkem/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

原文地址:https://www.cnblogs.com/outsrkem/p/11764264.html