MongoDB Installation & Startup

Source: Internet
Author: User
Tags mongo shell

MongoDB Installation

The version used is 3.0 and the virtual machine operating system is rhel-server-7.0-x86_64
1. Upload and unzip the mongodb-linux-x86_64-rhel70-3.0.11.tgz to the/usr/local/mongodb directory
2. Setting Environment variables
# Vi/etc/profile
Add Export path= $PATH:/usr/local/mongodb/bin
# Source/etc/profile
# mongo-version
MongoDB Shell version:3.0.11

OK, then test it.

First create a new directory, MongoDB related data files are placed in this directory
# Mkdir/data/mongodb

MongoDB Boot

When you start MongoDB, you can add parameters to the command line, and you can write the parameters in the configuration file
1. Parameters are written in the configuration file
There are many kinds of parameters, such as log, database, network, cluster ...
Detailed parameters and instructions See official website: https://docs.mongodb.org/manual/reference/configuration-options/

Create a new configuration file under the/data/mongodb directory mongo.conf
Note:Indent content does not support tab only with spaces ...
The contents of the configuration file are:
Systemlog:
Destination:file
Path: "/data/mongod.log"
Logappend:true
Storage
DbPath:/data/mongodb
Journal
Enabled:true
Directoryperdb:true
Processmanagement:
Fork:true
Net
bindip:127.0.0.1
port:27017

Start the Mongod service
# Mongod--config/data/mongodb/mongo.conf
About-to-fork child process, waiting until server was ready for connections.
Forked process:3037
Child process started successfully, parent exiting

Service started successfully
# Ps-aux|grep Mongod
Root 3037 1.8 1.6 490120 46544? Sl 10:28 0:00 Mongod--config/data/mongodb/mongo.conf
Root 3049 0.0 0.0 112640 980 pts/0 s+ 10:28 0:00 grep--color=auto Mongod

Connecting to the MONGO shell
# MONGO--port 27017
MongoDB Shell version:3.0.11
Connecting To:127.0.0.1:27017/test
>

OK, the boot is complete.

2. command line specifying parameters
Command-line start-up is even easier. Enter the command directly
Mongod--port=27017--dbpath=/data/mongodb--logpath=/data/mongod.log--logappend--directoryperdb--fork

About the configuration file and command line options parameters, I think you can put each server shared configuration in the file, targeted configuration, placed in the command line, better unified management

Briefly describe the parameters used:
--port: Port number
--dbpath: Database File storage Path
--logpath: Log storage location
--logappend: Append log to end of file
--directoryperdb:true uses a separate directory to store data for each database
--fork: Running in the background

In addition, now the machine is basically multi-CPU, multi-memory block, if we use the Mongod command directly enabled will get a warning
Warning:you is running on a NUMA machine.

Only need to be added before the original start commandNumactl–interleave=all, such as the start command above
# cd/usr/local/mongodb/bin/
Numactl–interleave=all./mongod--port=27017--dbpath=/data/mongodb--logpath=/data/mongod.log--logappend-- Directoryperdb--fork

As to why this started, I found a piece of article from the Internet, do not know whether can completely explain the problem, you can understand
https://www.ttlsa.com/mongodb/mongodb-numa/

MongoDB Installation & Startup

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.