一、添加yum源

vi /etc/yum.repos.d/mongodb-org-3.0.repo

请添加如下配置(64位系统):

[mongodb-org-3.0]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1

二、安装MongoDB

sudo yum install -y mongodb-org

三、修改soft rlimits的限制

 vi /etc/security/limits.conf

在文件最后加上

mongod soft nproc 65536
mongod hard nproc 65536

如果不做第三步,启动mongodb后会出现下面的提示

2015-05-21T14:58:52.493+0800 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 1024 processes, 65536 files. Number of processes should be at least 32768 : 0.5 times number of files.

四、配置MongoDB(使用wiredTiger引擎)

vi /etc/mongod.conf

根据下面的配置修改/etc/mongod.conf里的配置

# mongod.conf

#where to log
logpath=/var/log/mongodb/mongod.log logappend=true # fork and run in background
fork=true #port=27017 dbpath=/var/lib/mongo # location of pidfile
pidfilepath=/var/run/mongodb/mongod.pid # Listen to local interface only. Comment out to listen on all interfaces.
#bind_ip=192.168.0.31 # Disables write-ahead journaling
nojournal=true # Enables periodic logging of CPU utilization and I/O wait
#cpu=true # Turn on/off security. Off is currently the default
#noauth=true
#auth=true # Verbose logging output.
#verbose=true # Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck=true # Enable db quota management
#quota=true # Set oplogging level where n is
# 0=off (default)
# 1=W
# 2=R
# 3=both
# 7=W+some reads
#diaglog=0
# Ignore query hints
#nohints=true # Enable the HTTP interface (Defaults to port 28017).
#httpinterface=true # Turns off server-side scripting. This will result in greatly limited
# functionality
#noscripting=true # Turns off table scans. Any query that would do a table scan fails.
#notablescan=true # Disable data file preallocation.
#noprealloc=true # Specify .ns file size for new databases.
# nssize=<size> storageEngine=wiredTiger
wiredTigerCacheSizeGB=10
wiredTigerStatisticsLogDelaySecs=0
wiredTigerJournalCompressor=snappy
wiredTigerDirectoryForIndexes=true
wiredTigerCollectionBlockCompressor=snappy
wiredTigerIndexPrefixCompression=1 # Replication Options # in replicated mongo databases, specify the replica set name here
#replSet=yourrs
# maximum size in megabytes for replication operation log
oplogSize=10240
# path to a key file storing authentication info for connections
# between replica set members
#keyFile=/path/to/keyfile

五、启动MongoDB

/etc/init.d/mongod start

六、创建管理员账号

进入mongo

mongo

在mongo shell里面输入

use admin

进入admin库之后,输入

db.createUser({user: "admin",pwd: "admin",roles: [ "dbAdmin" ]})

这样就创建了一个用户名是admin,密码是admin的管理员角色的用户。

版权声明:本文为博主原创文章,未经博主允许不得转载。

centos 安装mongodb3.0的更多相关文章

  1. CentOS 安装mongodb3.0 二进制包

    1.下载mongodb因为64位系统CentOS,所以下载64位的安装包: wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0 ...

  2. 【推荐】CentOS安装Tomcat-7.0.57+启动配置+安全配置+性能配置

    注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Tomcat之前,请确保已经安装了JDK-1.7环境,具体见<CentOS安装JDK-1.7>. ...

  3. 【推荐】CentOS安装vsftpd-3.0.2+安全配置

    注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. FTP的登录一般有三种方式,分别是: 匿名用户形式:默认安装的情况下,系统只提供匿名用户访问,只需要输入用户anonymous/f ...

  4. centos 安装php7.0.2

    PHP7.0正式版已经在2015年11月份左右发布,目前是PHP7.0.2版本,本人最早是从2015年8月php7的第一个测试版跟起,现在正式版发布. linux版本:64位CentOS 6.6 Ng ...

  5. 【推荐】CentOS安装vsftpd-3.0.3+安全配置

    注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. FTP的登录一般有三种方式,分别是: 匿名用户形式:默认安装的情况下,系统只提供匿名用户访问,只需要输入用户anonymous/f ...

  6. CentOS安装GlassFish4.0 配置JDBC连接MySQL

    转自:http://linux.it.net.cn/CentOS/course/2014/0724/3319.html 版本glassfish-4.0.zip 1.解压,拷贝到指定安装路径   unz ...

  7. centos 安装mysql8.0.16

    清除自带的mariadb > rpm -qa|grep mariadb mariadb-libs-5.5.44-2.el7.centos.x86_64 > rpm -e --nodeps ...

  8. centos 安装 mongo3.0

    官方网站传贴,每次去翻doc,麻烦 vi  /etc/yum.repos.d/mongodb-org-3.0.repo [mongodb-org-3.0]name=MongoDB Repository ...

  9. centos安装tomcat7.0.70

    抄自:https://www.cnblogs.com/www1707/p/6592504.html apache-tomcat-7.0.70jdk-7u67-linux-x64 下载tomcathtt ...

随机推荐

  1. 拦截器springmvc防止表单重复提交【3】自己实际项目

    1:[定义注解] package com.jspxcms.ext.interceptor; import java.lang.annotation.ElementType; import java.l ...

  2. bzoj 3052 糖果公园

    Written with StackEdit. Description \(Candyland\) 有一座糖果公园,公园里不仅有美丽的风景.好玩的游乐项目,还有许多免费糖果的发放点,这引来了许多贪吃的 ...

  3. java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream异常解决方法

    使用Tomcat部署Servlet程序时,单步调试跟踪到: List<FileItem> itemList = sfu.parseRequest(request); 总是会报错:Java. ...

  4. php 日期时间运算比较

    $sql= "select * from t_datestudy where id='4750' and agreemode='2' and school_agree !='1'" ...

  5. bzoj 2763 [JLOI2011]飞行路线——分层图

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2763 分层图两种方法的练习. 1.把图分成k+1层,本层去上面一层的边免费.但空间时间都不算 ...

  6. spring mvc静态资源访问的配置

    如果我们使用spring mvc来做web访问请求的控制转发,那么默认所有访问都将被DispatcherServlet独裁统治.比如我现在想访问的欢迎页index.html根本无需任何业务逻辑处理,仅 ...

  7. .NET泛型与非泛型的问题

    泛型集合通常情况下,建议您使用泛型集合,因为这样可以获得类型安全的直接优点而不需要从基集合类型派生并实现类型特定的成员.下面的泛型类型对应于现有的集合类型:1.List 是对应于 ArrayList ...

  8. 大数据竞赛平台——Kaggle 入门篇

    这篇文章适合那些刚接触Kaggle.想尽快熟悉Kaggle并且独立完成一个竞赛项目的网友,对于已经在Kaggle上参赛过的网友来说,大可不必耗费时间阅读本文.本文分为两部分介绍Kaggle,第一部分简 ...

  9. sqlserver卸载

  10. EM64T和64位是不是一个概念啊?他们有什么区别啊,怎么区分啊?

    首先我们要解决什么是64位这个问题.究竟什么是64位处理器呢?64 bit是相对于32 Bit而言的,这个位数指的是CPU GPRs(General-Purpose Registers,通用寄存器)数 ...