配置包管理系统 (yum).

Xshell登录Linux查看操作系统版本信息

lsb release -a



可以在官网选择对应的版本 :官网的安装指导文档http://docs.mongodb.org/master/tutorial/install-mongodb-on-red-hat/?_ga=1.257322251.1286217449.1439789733

创建一个 /etc/yum.repos.d/mongodb-org-3.4.repo文件就可以直接通过yum安装mongodb了

vim /etc/yum.repos.d/mongodb-org-3.4.repo

复制如下

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

esc :wq回车保存并退出

安装

yum install -y mongodb-org

使用mongodb

启动

service mongod start

停止

service mongod stop

重启

service mongod restart

客户端

mongo

配置

查看mongodb安装在哪了

whereis mongod

修改相关配置以便远程连接

vim /etc/mongod.conf

只监听本地接口。注释掉监听所有接口。

bind_ip = 127.0.0.1

默认情况下,MongoDB绑定到本地接口,它将限制远程连接。如果你不关心安全,只是注释掉接受任何远程连接(不推荐)
因为都是在同一个局域网网络,你只需要将MongoDB绑定到它自己的私有IP接口。

vim /etc/mongod.conf

/etc/mongod.conf

监听本地和局域网接口。

bind_ip = 127.0.0.1,192.168.161.100

允许开发人员远程访问

开发人员将通过MongoDB公共IP 45.56.65.100远程访问,允许,将公共IP绑定接口。

vim /etc/mongod.conf

/etc/mongod.conf

监听本地,局域网和公共接口。

bind_ip = 127.0.0.1,192.168.161.100,45.56.65.100

重新启动MongoDB生效。
# IpTables防火墙 如果你有防火墙,允许在端口27017上的连接,MongoDB缺省端口。 Any connections can connect to MongoDB on port 27017

iptables -A INPUT -p tcp --dport 27017 -j ACCEPT

Only certain IP can connect to MongoDB on port 27017

iptables -A INPUT -s -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPT

iptables -A OUTPUT -d -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT

iptables -A INPUT -s 192.168.161.200 -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPT

iptables -A OUTPUT -d 192.168.161.200 -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT

参考链接:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
http://www.linuxidc.com/Linux/2016-07/133413.htm
http://blog.csdn.net/done58/article/details/47726815
http://ju.outofmemory.cn/entry/150644 ## windows 安装 此版本3.4
官网下载对应版本的安装包知道安装完成
## 注册mongodb为windows服务

D:\Databases\MongoDB\bin>mongod --dbpath "d:\mongodata\db" --logpath "d:\mongodata\logs\mongo.log" --install --serviceName "MongoDB"

用gitbash不行用window自带命令行

阿里云部署mongdb(CentOS)的更多相关文章

  1. 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署

    阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...

  2. 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署

    阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...

  3. 阿里云服务器Linux CentOS安装配置(五)jetty配置、部署

    阿里云服务器Linux CentOS安装配置(五)jetty配置.部署 1.官网下载jetty:wget http://repo1.maven.org/maven2/org/eclipse/jetty ...

  4. 阿里云服务器Linux CentOS安装配置(零)目录

    阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...

  5. 阿里云服务器Linux CentOS安装配置(四)yum安装tomcat

    阿里云服务器Linux CentOS安装配置(四)yum安装tomcat 1.yum -y install tomcat  执行命令后,会帮你把jdk也安装好 2.tomcat安装目录:/var/li ...

  6. 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器

    阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 我在阿里云购买的服务器配置 CPU:1核 内存:2G 系统盘:40G 公共镜像:CentOS 6.5 64位 公网带宽:1Mbps ...

  7. 阿里云部署Docker(5)----管理和公布您的镜像

    出到这节,我在百度搜索了一下"阿里云部署Docker",突然发现怎么会有人跟我写的一样呢?哦,原来是其它博客系统的爬虫来抓取,然后也不会写转载自什么什么的.所以,我最终明确为什么那 ...

  8. 阿里云部署django实现公网访问

    本博的主要目的是对阿里云部署django实现公网访问进行一次简单的记录,方便日后查询. 内容目录: (1)申请阿里云服务器及安全组配置 (2)实现ssh远程控制 (3)实现ftp文件传输 (4)安装p ...

  9. 阿里云部署Java开发环境

    阿里云部署Java网站和微信开发调试心得技巧(上) 本文主要是记录在阿里云服务器从零开始搭建Java执行环境并且部署web project的过程,方面以后查阅. 一.申请阿里云服务器 购买阿里云服务器 ...

随机推荐

  1. hadoop2.6.0实践:控制台入口url列表

    hadoop web控制台页面的端口整理: 50070:hdfs文件管理 8088:ResourceManager 8042:NodeManager 19888:JobHistory(使用" ...

  2. 译《Time, Clocks, and the Ordering of Events in a Distributed System》

    Motivation <Time, Clocks, and the Ordering of Events in a Distributed System>大概是在分布式领域被引用的最多的一 ...

  3. tornado解决高并发的初步认识牵扯出的一些问题

    #!/bin/env python # -*- coding:utf-8 -*- import tornado.httpserver import tornado.ioloop import torn ...

  4. Hadoop API:遍历文件分区目录,并根据目录下的数据进行并行提交spark任务

    hadoop api提供了一些遍历文件的api,通过该api可以实现遍历文件目录: import java.io.FileNotFoundException; import java.io.IOExc ...

  5. Oracle12c:支持通过创建identity columen来实现创建自增列

    oracle12c之前如果需要创建自增列必须要通过sequence+trigger来实现.但是oracle12c已经可以像mysql,sqlserver一样通过identity column来设置自增 ...

  6. wpf的tab移动焦点只能在容器内部使用

    设置 KeyboardNavigation.TabNavigation="Cycle" 即可

  7. round()函数 浮点数的四舍五入

    浮点数的四舍五入 print round(1.7333) 2.0

  8. [python]_ELVE_pip2和pip3如何共存

    作者:匿名用户链接:https://www.zhihu.com/question/21653286/answer/95532074来源:知乎著作权归作者所有,转载请联系作者获得授权. 想学习Pytho ...

  9. mvc4.0 @Styles.Render(转)

    1.@Styles.Render 在页面上可以用@Styles.Render("~/Content/css") 来加载css 首先要在App_Start 里面BundleConfi ...

  10. JavaScript 散集合(HashArray)

    散列表和散列映射是一样的,我们已经在本章中介绍了这种数据结构. 在一些编程语言中,还有一种叫作散列集合的实现.散列集合由一个集合构成,但是插入. 移除或获取元素时,使用的是散列函数.我们可以重用本章中 ...