mongodb安装

官网安装:

https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-red-hat/

 

开源版本:

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

 

Red Hat Enterprise Linux 7

 
yum install cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs libcurl libpcap lm_sensors-libs net-snmp net-snmp-agent-libs openldap openssl rpm-libs tcp_wrappers-libs

wget https://fastdl.mongodb.org/src/mongodb-src-r4.2.0.tar.gz


mongodb启动:
 service mongod stop
 service mongod start

https://www.open-open.com/lib/view/open1435117403544.html

 启动Mongodb服务有两种方式,前台启动或者Daemon方式启动,前者启动会需要保持当前Session不能被关闭,后者可以作为系统的fork进程执行,下文中的path是mongodb部署的实际地址。

    1. 最简单的启动方式,前台启动,仅指定数据目录,并且使用默认的27107端口,cli下可以直接使用./mongo连上本机的mongodb,一般只用于临时的开发测试。

./mongod --dbpath=/path/mongodb


    2. 启动绑定固定的IP地址、端口,这就mongo在连接mongod的时候就需要指定IP和端口了。

./mongod --dbpath=/path/mongodb --bind_ip=10.10.10.10 --port=12345
//连接mongod
./mongo 10.10.10.10:12345


    3. daemon后台运行,简单的是命令后面加“&”。

./mongod --dbpath=/path/mongodb --bind_ip=10.10.10.10 --port=12345 &


    或者使用mongod自带的--fork参数,此时必须指定log的路径。

./mongod --dbpath=/path/mongodb --fork=true logpath=/path/mongod.log


    4. (推荐)以配置文件形式保存配置。

port=12345
bind_ip=10.10.10.10
logpath=/path/mongod.log
pidfilepath=/path/mongod.pid
logappend=true
fork=true


  然后启动mongod时引入配置文件

./mongod -f /path/mongod.conf


下面是mongod启动的常用参数详细说明:

 

</tr>
</tr>
</tr>
</tr>
</tr>
</tr>
</tr>
</tbody>
</table>
</p>


客户端下载:
https://robomongo.org/









posted @ 2019-09-26 13:38  zhouyuqiang  阅读(549)  评论(2编辑  收藏  举报