centos6.5 配置mongodb3

时间:2021-10-22 23:50:23

下载地址

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/data

mkdir /usr/local/mongodb/data/mongodb_log

touch /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 directory

yum whatprovides libstdc++.so.6

Loaded plugins: security
libstdc++-4.4.7-16.el6.i686 : GNU Standard C++ Library
Repo : base
Matched from:
Other : libstdc++.so.6 yum 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&

./mongo

MongoDB shell version: 3.0.2
connecting to: test

成功了

测试

 netstat -lanp | grep ""
tcp               0.0.0.0:               0.0.0.0:*                   LISTEN      /./mongod
unix [ ACC ] STREAM LISTENING /./mongod /tmp/mongodb-.sock

访问

http://127.0.0.1:27017/