centos6.9上mongdb安装

一、设置yum源

vi /etc/yum.repos.d/mongodb.repo 
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

二、安装mongdb

yum -y install mongodb-org 

三、验证安装结果

[root@ipr-mongo ~]# rpm -qa |grep mongodb
mongodb-org-tools-3.4.4-1.el6.x86_64
mongodb-org-server-3.4.4-1.el6.x86_64
mongodb-org-mongos-3.4.4-1.el6.x86_64
mongodb-org-shell-3.4.4-1.el6.x86_64
mongodb-org-3.4.4-1.el6.x86_64
[root@ipr-mongo ~]# rpm -ql mongodb-org-server
/etc/init.d/mongod
/etc/mongod.conf
/etc/sysconfig/mongod
/usr/bin/mongod
/usr/share/doc/mongodb-org-server-3.4.4
/usr/share/doc/mongodb-org-server-3.4.4/GNU-AGPL-3.0
/usr/share/doc/mongodb-org-server-3.4.4/MPL-2
/usr/share/doc/mongodb-org-server-3.4.4/README
/usr/share/doc/mongodb-org-server-3.4.4/THIRD-PARTY-NOTICES
/usr/share/man/man1/mongod.1
/var/lib/mongo
/var/log/mongodb
/var/log/mongodb/mongod.log
/var/run/mongodb

四、启动

[root@ipr-mongo ~]# /etc/init.d/mongod start
Starting mongod: [  OK  ]

五、查看监听

[root@ipr-mongo ~]# netstat -nltp|grep mongo
tcp        0      0 127.0.0.1:27017             0.0.0.0:*                   LISTEN      2284/mongod         

六、出现的问题

如果出现连接27017端口是报连接被拒绝,可以修改如下配置,默认值允许本机连接。

 vi /etc/mongod.conf
 bindIp: 127.0.0.1  改为 bindIp: 0.0.0.0

重启mongdb
/etc/init.d/mongod  restart

 

posted @ 2018-11-01 17:32  凉生墨客  阅读(483)  评论(0编辑  收藏