你的位置:首页 > 数据库

[数据库]centos6.5 配置mongodb3


下载地址

http://www.mongodb.org/downloads

下载

curl -O -L https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.0.2.tgz

 

解压安装

tar -xvzf mongodb-Liunix-xxxxx.tgz mv mongodb-linux-i686-3.0.2 /usr/local/mongodb

 

创建目录

mkdir /usr/local/mongodb/datamkdir /usr/local/mongodb/data/mongodb_logtouch /usr/local/mongodb/data/mongodb_log/mongodb.log

 

 

启动脚本

./mongod --dbpath=/usr/local/mongodb/data/mongodb_data/ --logpath=/usr/local/mongodb/data/mongodb_log/mongodb.log --logappend&

 

报错,如下操作:

./mongod: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directoryyum whatprovides libstdc++.so.6Loaded plugins: securitylibstdc++-4.4.7-16.el6.i686 : GNU Standard C++ LibraryRepo : baseMatched from:Other : libstdc++.so.6yum install libstdc++-4.4.7-16.el6.i686 

 

安装完成,再运行

./mongod --dbpath=/usr/local/mongodb/data/mongodb_data/ --logpath=/usr/local/mongodb/data/mongodb_log/mongodb.log --logappend&./mongoMongoDB shell version: 3.0.2connecting to: test

成功了

测试

 netstat -lanp | grep "27017"

tcp    0   0 0.0.0.0:27017        0.0.0.0:*          LISTEN   19556/./mongodunix 2   [ ACC ]   STREAM   LISTENING   131807 19556/./mongod   /tmp/mongodb-27017.sock

 

访问

http://127.0.0.1:27017/