MongoDB 3.6 Installation Detailed

Source: Internet
Author: User
Tags mongodb

The default version of MongoDB in the package installation source for Ubuntu and most Linux distributions is 2.4, but 2.4 uses a storage engine that does not support collecitons-level locks, only the database level, so a lock table occurs when a 2.4 version of MongoDB writes in development, resulting in a number The library performance is low, so it needs to be updated to more than 3.4 versions.

  

The update environment is Ubuntu 14.4, there are two ways to update, but be careful to back up the database first, Mongodump.

Method One: Apt Install

1. Add Public key:

sudo apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv 2930adae8caf5059ee73bb4b58712a2291fa4ad5

2. Add the package Source:

echo "Deb [ARCH=AMD64] https://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.6 Multiverse" | sudo tee/etc/apt/sources.list.d/mongodb-org-3.6.list

3. Update:

sudo apt-get update

4. Installation:

sudo apt-get install-y mongodb-org

You can also specify the version: sudo apt-get install-y mongodb-org=3.6.0 mongodb-org-server=3.6.0 Mongodb-org-shell= 3.6.0 Mongodb-org-mongos=3.6.0 mongodb-org-tools=3.6.0

Method 2:2 installation of the binary package

1. Download the package:

Curl-o https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.0.tgz

2. Unzip:

TAR-ZXVF mongodb-linux-x86_64-3.6.0.tgz

3. Create a directory:

Mkdir-p MongoDB

Cp-r-N Mongodb-linux-x86_64-3.6.0/mongodb

 4. Export path:

    Export PATH=<mongodb-install-directory>/bin:$PATH

Preferably in BASHRC or profile, without having to export manually every time.

NOTES: Resolving Problems with TPH warning

   

Create a file under the/etc/init.d/directory/etc/init.d/disable-transparent-hugepages

#!/bin/bash### BEGIN INIT info# provides:disable-transparent-hugepages# Required-Start: $local _fs# Required-stop:# X-start-before:mongod mongodb-mms-automation-agent# Default-start:2 3 4 5# Default-stop:0 1 6# Short-description:disable Linux transparent huge pages# description:disable Linux transparent huge pages, to improve # database performance.### END INIT INFO Case$1 inchstart)if[-d/sys/kernel/mm/transparent_hugepage]; ThenThp_path=/sys/kernel/mm/Transparent_hugepageelif[-d/sys/kernel/mm/redhat_transparent_hugepage]; ThenThp_path=/sys/kernel/mm/Redhat_transparent_hugepageElsereturn0    fi    Echo 'never'> ${thp_path}/enabledEcho 'never'> ${thp_path}/Defrag Re='^[0-1]+$'    if[[ $(Cat${thp_path}/khugepaged/defrag) =~$re]]  Then# RHEL7      Echo 0> ${thp_path}/khugepaged/DefragElse# RHEL6      Echo 'No'> ${thp_path}/khugepaged/Defragfiunset re unset thp_path;;Esac

Then add executable permissions:

755/etc/init.d/disable-transparent-hugepages

Finally add self-boot to:
Update-RC.  Disable-transparent-defaults       

MongoDB 3.6 Installation Detailed

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.