配置包管理系统 (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. python3下搜狗AI API实现

    1.背景 a.搜狗也发布了自己的人工智能 api,包括身份证ocr.名片ocr.文本翻译等API,初试感觉准确率一般般. b.基于python3. c.也有自己的签名生成这块,有了鹅厂的底子,相对写起 ...

  2. priority queue优先队列初次使用

    题目,排队打印问题 Input Format One line with a positive integer: the number of test cases (at most 20). Then ...

  3. Spring MVC的核心流程(步骤)

    具体步骤: 1.客户端发送请求先要经过前端控制器,请求被Spring 前端控制器DispatcherServlet获取,如详细图第一步:DispatcherServlet对请求URL进行解析(比如我们 ...

  4. SVN上传项目步骤

    1.svn上传项目  首先选中父工程 ,右键选中Team的share project 2.share完再选中SVN 3.选中项目  一个一个share project 4.

  5. ashx页面怎么调用Handler的Session

    aspx里面直接可以用Session["Name"]进行赋值和取值,ashx中就得继承接口IRequiresSessionState.然后使用! 实现: public class ...

  6. @OnetoOne @OnetoMany @ManyToOne(2)

    在班主任(id,name,bjid) 班级(id name) 学生(id name bjid)的 关系中 班主任一对一关联班级 班级一对多关联学生 @OnetoOne @joinColumn(bjid ...

  7. 探寻 webpack 插件机制

    webpack 可谓是让人欣喜又让人忧,功能强大但需要一定的学习成本.在探寻 webpack 插件机制前,首先需要了解一件有意思的事情,webpack 插件机制是整个 webpack 工具的骨架,而 ...

  8. [LeetCode] Falling Squares 下落的方块

    On an infinite number line (x-axis), we drop given squares in the order they are given. The i-th squ ...

  9. [LeetCode] Repeated String Match 重复字符串匹配

    Given two strings A and B, find the minimum number of times A has to be repeated such that B is a su ...

  10. vim 多行缩进

    按v进入可视化模式后, 选中要缩进的多行, 后按shift+.实现多行缩进.