您好,登录后才能下订单哦!
Centos6.4 x64简单安装MongoDB
一、下载MongoDB2.4.9版
下载MongoDB
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz
解压MongoDB
tar -zxvf mongodb-linux-x86_64-2.4.9.tgz -C /usr/src
移动MongoDB目录
mv /usr/src/mongodb-linux-x86_64-2.4.9 /usr/local/mongodb
二、部署MongoDB
进入MongoDB目录
cd /usr/local/mongodb
创建数据目录和日志目录
mkdir -p /data/mongodb/db
mkdir -p /data/mongodb/log
vi /etc/profile
PATH=$PATH:/usr/local/mongodb/bin
source /etc/profile
以后台方式启动MongoDB
mongod --dbpath=/data/mongodb/db --logpath=/data/mongodb/log/mongodb.log --fork
about to fork child process, waiting untilserver is ready for connections.
forked process: 6440
all output going to:/data/mongodb/log/mongodb.log
child process started successfully, parentexiting
设置开机启动MongoDB
echo "mongod --dbpath=/data/mongodb/db --logpath=/data/mongodb/log/mongodb.log --fork" >> /etc/rc.local
查看是否运行
pgrep mongo -l
6440 mongod
进入数据库
mongo
MongoDB shell version: 2.4.9
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type"help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
>
> show dbs
local 0.078125GB
>exit
bye
查看端口
netstat -nalupt | grep mongo
tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN 6440/mongod
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 6440/mongod
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。