centos7虚拟机搭建单机mongodb

centos安装mongodb单机

官网下载mongodb包、解压、配置环境变量

[root@localhost software]# cd mongodb/
[root@localhost mongodb]# ll
total 0
[root@localhost mongodb]# pwd
/software/mongodb
[root@localhost mongodb]# ll
total 0
[root@localhost mongodb]# rz -E
rz waiting to receive.
[root@localhost mongodb]# ll
total 71552
-rw-r--r--. 1 root root 73265692 Feb  5 13:32 mongodb-linux-x86_64-4.0.6.tgz
[root@localhost mongodb]# tar -zxvf mongodb-linux-x86_64-4.0.6.tgz 
mongodb-linux-x86_64-4.0.6/README
mongodb-linux-x86_64-4.0.6/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-4.0.6/MPL-2
mongodb-linux-x86_64-4.0.6/LICENSE-Community.txt
mongodb-linux-x86_64-4.0.6/bin/mongodump
mongodb-linux-x86_64-4.0.6/bin/mongorestore
mongodb-linux-x86_64-4.0.6/bin/mongoexport
mongodb-linux-x86_64-4.0.6/bin/mongoimport
mongodb-linux-x86_64-4.0.6/bin/mongostat
mongodb-linux-x86_64-4.0.6/bin/mongotop
mongodb-linux-x86_64-4.0.6/bin/bsondump
mongodb-linux-x86_64-4.0.6/bin/mongofiles
mongodb-linux-x86_64-4.0.6/bin/mongoreplay
mongodb-linux-x86_64-4.0.6/bin/mongod
mongodb-linux-x86_64-4.0.6/bin/mongos
mongodb-linux-x86_64-4.0.6/bin/mongo
mongodb-linux-x86_64-4.0.6/bin/install_compass
[root@localhost mongodb]# ll
total 71552
drwxr-xr-x. 3 root root       95 Mar 12 22:42 mongodb-linux-x86_64-4.0.6
-rw-r--r--. 1 root root 73265692 Feb  5 13:32 mongodb-linux-x86_64-4.0.6.tgz
[root@localhost mongodb]# cd mongodb-linux-x86_64-4.0.6/
[root@localhost mongodb-linux-x86_64-4.0.6]# pwd
/software/mongodb/mongodb-linux-x86_64-4.0.6
[root@localhost mongodb-linux-x86_64-4.0.6]# vim /etc/profile
[root@localhost mongodb-linux-x86_64-4.0.6]# cat /etc/profile
配置好的环境变量
# mongodb
export MONGODB_HOME=/software/mongodb/mongodb-linux-x86_64-4.0.6
export PATH=$PATH:$MONGODB_HOME/bin
重启环境变量
[root@localhost mongodb-linux-x86_64-4.0.6]# source /etc/profile

创建db和logs目录

[root@localhost mongodb-linux-x86_64-4.0.6]# mkdir -p data/db
[root@localhost mongodb-linux-x86_64-4.0.6]# mkdir -p data/logs
[root@localhost mongodb-linux-x86_64-4.0.6]# ll
total 116
drwxr-xr-x. 2 root root  4096 Mar 12 22:42 bin
drwxr-xr-x. 4 root root    26 Mar 12 22:47 data
-rw-r--r--. 1 root root 30608 Feb  5 13:08 LICENSE-Community.txt
-rw-r--r--. 1 root root 16726 Feb  5 13:08 MPL-2
-rw-r--r--. 1 root root  2601 Feb  5 13:08 README
-rw-r--r--. 1 root root 57190 Feb  5 13:08 THIRD-PARTY-NOTICES
[root@localhost mongodb-linux-x86_64-4.0.6]# tree data/ -L 1
data/
├── db
└── logs

2 directories, 0 files

创建日志文件

[root@localhost mongodb-linux-x86_64-4.0.6]# touch data/logs/mongodb.log
[root@localhost mongodb-linux-x86_64-4.0.6]# tree data/ -L 2
data/
├── db
└── logs
    └── mongodb.log

2 directories, 1 file

创建配置文件

[root@localhost mongodb-linux-x86_64-4.0.6]# vim mongodb.conf
[root@localhost mongodb-linux-x86_64-4.0.6]# cat mongodb.conf 
dbpath=/software/mongodb/mongodb-linux-x86_64-4.0.6/data/db
logpath=/software/mongodb/mongodb-linux-x86_64-4.0.6/data/logs/mongodb.log
port=27017
fork=true
logappend=true
bind_ip=0.0.0.0

启动mongodb

[root@localhost mongodb-linux-x86_64-4.0.6]# ./bin/mongod --config mongodb.conf 
about to fork child process, waiting until server is ready for connections.
forked process: 10799
child process started successfully, parent exiting
[root@localhost mongodb-linux-x86_64-4.0.6]# ps -ef | grep mongod
root      10799      1 10 22:54 ?        00:00:01 ./bin/mongod --config mongodb.conf
root      10846   2752  0 22:54 pts/0    00:00:00 grep --color=auto mongod

拾柒……

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值