mongodb3.2安装与基本配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mongodb3.2安装与基本配置相关的知识,希望对你有一定的参考价值。

一、使用yum安装mongodb 3.2

[[email protected] ~]# cat /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=0

enabled=1

[[email protected] ~]# yum install mongodb-org*


[[email protected] ~]# egrep -v "^(#|$)" /etc/mongod.conf

systemLog:

  destination: file

  logAppend: true

  path: /data/mongodb/log/mongod.log

storage:

  dbPath: /data/mongodb/data

  directoryPerDB: true

  journal:

    enabled: true

processManagement:

  fork: true  # fork and run in background

  pidFilePath: /data/mongodb/conf/mongod.pid  # location of pidfile

net:

  port: 27027

  #bindIp: 127.0.0.1  # Listen to local interface only, comment to listen on all interfaces.

[[email protected] ~]# mkdir -p /data/mongodb/{conf,data,log} 

[[email protected] ~]# chown -R mongod.  /data/mongodb


[[email protected] ~]# tail /etc/security/limits.conf

# End of file

mongod soft nproc 40000

* hard nofile 1000000

* soft nofile 1000000

* soft core unlimited

* soft stack 10240

* - nofile 65535

push - nproc 65535

push - nofile 320000

work - nproc 10000


[[email protected] ~]# cat /etc/security/limits.d/90-nproc.conf

# Default limit for number of user‘s processes to prevent

# accidental fork bombs.

# See rhbz #432903 for reasoning.


*          soft    nproc     1024

root       soft    nproc     unlimited

[[email protected] ~]#


[[email protected] ~]# sed -n ‘62,64p‘ /etc/init.d/mongod

if [ -f /sys/kernel/mm/transparent_hugepage/defrag ] ; then

echo never > /sys/kernel/mm/transparent_hugepage/defrag

fi

[[email protected] ~]# service mongod  start 


二、macbook pro 上安装mongodb

  参考: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

安装brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew update

brew install mongodb

mongod  - -config /usr/local/etc/mongod.conf

三、mongo 客户端工具有: http://docs.mongodb.org/ecosystem/tools/administration-interfaces/



本文出自 “11462293” 博客,请务必保留此出处http://11472293.blog.51cto.com/11462293/1790860

以上是关于mongodb3.2安装与基本配置的主要内容,如果未能解决你的问题,请参考以下文章

MongoDB3.2.7安装及用户角色配置

mongodb3.2安装

CentOS7.2 上安装MongoDB3.2-3.3笔记

Mongodb3分片部署及故障模拟验证

mongodb3.2配置文件yaml格式 详解

MongoDB3.2配置文件.md