Installing the MongoDB non-relational database

Source: Internet
Author: User
Tags install mongodb install openssl openssl

Installing MongoDB non-relational database MongoDB Basic skills target
    • Understanding the basic concepts of MongoDB database
    • Learn to install MongoDB database
MongoDB Overview

MongoDB is an open source document database and is the industry's leading NoSQL database, written in C + +

About MongoDB

MongoDB is a cross-platform, document-oriented database. Can achieve high performance, high availability, and can be easily extended. In the case of high load, adding more nodes can guarantee the server performance

MongoDB is a kind of product between relational database and non-relational database, the most abundant function in non-relational database, the most want relational database

MongoDB Features

MongoDB features include set-oriented storage, schema free, rich query statements, multi-set index, replication set mechanism, easy horizontal expansion, pluggable storage engine

MongoDB installation simply provides a document-oriented storage space, which is easier to operate.

MONGODB provides replication, high availability, and automatic sharding capabilities,

MongoDB supports rich query expressions,

MongoDB supports a variety of programming languages: Ruby, Python, Java, C + +, PHP, and many other languages

MongoDB Suitable for the field

MongoDB can provide a scalable and high-performance database storage solution for Web applications, and MongoDB's main areas of application are site data, distributed scenarios, data caches, and JSON document format storage

The first installation method configures the Yum source repository with the Yum online installation-----------------------------
[[email protected] ~] cd /etc/yum.repos.d/[[email protected] ~] vim mongodb-org[mongodb-org]name=MongoDB Repositorybaseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
-----------------Installing MongoDB--------------
yum  install -y mongodb-orgvi /etc/mongod.confbindIp: 0.0.0.0             #监听地址port: 27017                 #监听端口systemctl start mongod.servicenetstat -anpt | grep 27017/usr/bin/mongodb.version()show dbs;db.getMongo() //查看当前数据库机器的连接地址
-------------------turn on multi-instance-------------
cp -p /etc/mongod.conf /etc/mongod2.confvim /etc/mongod2.conf   path: /data/mongodb/mongod2.log   dbPath: /data/mongodb/mongo   port: 27018mkdir -p  /data/mongodb/cd /data/mongodb/mkdir mongotouch mongod2.logchmod 777 mongod2.logmongod -f /etc/mongod2.confmongo --port 27018netstat -ntap
The second on the Linux platform provided by MongoDB downloads the installation package website http://www.mongodb.org/downloads Download----------Install the Openssl-devel development package--------------
yum install openssl-devel -y
-----Extract the MongoDB source code package to/usr/local/---
tar zxvf mongodb-linux-x86_64-rhel70-4.0.0.tar.gz -C /optmkdir -p /data/mongodb          //创建储存文件夹mkdir -p /data/logs/mongodb/    //创建日志文件储存文件夹touch /data/logs/mongodb1.log  //创建日志文本chmod 755 /data/logs/mongodb/mongodb1.log  //给予日志文件文本权限
---Set the value of Ulimit-n and ulimit-u to be greater than 20000---
ulimit -u 25000ulimit -n 25000
--------Create a MongoDB profile startup parameter-------
cd /usr/local/mongodb/binvim mongodb1.conf# idae - MongoDB config start   # 设置数据文件的存放目录(根据实际的db文件夹的路径填写)     dbpath = /data/mongodb1   # 设置日志文件的存放目录及其日志文件名(根据实际的logs文件夹的路径填写)     logpath = /data/logs/mongodb/mongodb1.log   # 设置端口号(默认的端口号是 27017)     port = 27017   # 设置为以守护进程的方式运行,即在后台运行     fork = true   # nohttpinterface = true     logappend = true # idae - MongoDB config end   # 同时承受的并发连接数5000     maxConns = 5000   # 指定储存引擎为内存映射文件     storageEngine = mmapv1
------------------set the kernel parameters-------------------
echo 0 > /proc/sys/vm/zone_reclaim_modesysctl -w vm.zone_reclaim_mode=0            //永久设置echo never > /sys/kernel/mm/transparent_hugepage/enabledecho never > /sys/kernel/mm/transparent_hugepage/defrag
------------start the MongoDB command---------------
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb1.conf
-------------Close the MongoDB command--------------
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb1.conf --shutdown
-----------------Configure the card machine self-starting-----------------
vim /etc/rc.local   //在配置文件里面添加下列两项rm -rf /data/mongodb1/mongod.lock/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb1.conf
------------into the MongoDB database-------------
/usr/local/mongodb/bin/mongo
-------------View the MongoDB database------------
show dbs; 或 show databases;

Installing the MongoDB non-relational database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.