MongoDB配置简明文档
Posted Lambeto
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MongoDB配置简明文档相关的知识,希望对你有一定的参考价值。
1、下载MongoDB程序包(RHEL 7 Linux 64-bit x64)
[[email protected] /]# wget -P/usr/local/src/ https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.1.tgz
2、解压程序包:
[[email protected] /]# tar -xzvf mongodb-linux-x86_64-rhel70-4.0.1.tgz -C /usr/local/src/ [[email protected] /]# mv /usr/local/src/mongodb-linux-x86_64-rhel70-4.0.1 /usr/local/mongodb
3、创建程序运行所需的目录:
[[email protected] /]# mkdir /usr/local/mongodb/etc /usr/local/mongodb/data /usr/local/mongodb/log
4、创建MongoDB配置文件:
[[email protected] /]# vim /usr/local/mongodb/etc/mongod.conf dbpath = /usr/local/mongodb/data/ logpath = /usr/local/mongodb/log/mongodb.log pidfilepath = /usr/local/mongodb/log/mongodb.pid bind_ip = 127.0.0.1 port = 27017 fork = true
5、启动MongoDB程序:
[[email protected] /]# /usr/local/mongodb/bin/mongod -f /usr/local/mongodb/etc/mongod.conf
6、MongoDB添加到系统环境变量:
[[email protected] /]# sed -i ‘$a export MONGODB_HOME=/usr/local/mongodb export PATH=$MONGODB_HOME/bin:$PATH‘ /etc/profile
[[email protected] /]# source /etc/profile
7、MongoDB客户端登录:
[[email protected] /]# mongo MongoDB shell version v4.0.1 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 4.0.1
[THE END]
以上是关于MongoDB配置简明文档的主要内容,如果未能解决你的问题,请参考以下文章