Install MongoDB in Ubuntu

Source: Internet
Author: User
Tags install mongodb mongodb client mongodb server mongo shell
MongoDB has been widely used as a NoSQL Database in recent years. More and more enterprises are trying to use MongoDB instead of the original Database. MongoDB also performs well in clusters, sharding, and replication. I will introduce various MongoDB deployment experiments. Preface as a document-type NoSQL database, MongoDB is very flexible to use, avoiding the Complex Database Design in the early stage of relational databases. MongoD

MongoDB has been widely used as a NoSQL Database in recent years. More and more enterprises are trying to use MongoDB instead of the original Database. MongoDB also performs well in clusters, sharding, and replication. I will introduce various MongoDB deployment experiments.

Preface

As a document-type NoSQL database, MongoDB is very flexible to use, avoiding the Complex Database Design in the early stage of relational databases. MongoDB storage is based on the JSON format and uses Javascript as the database operating language. It gives users unlimited space to imagine and can solve very complex conditional queries on MongoDB servers through programming.

Directory

  1. Install MongoDB in Windows
  2. Install MongoDB in Linux Ubuntu
  3. Access MongoDB through the command line Client
1. Install MongoDB in Windows

Installing MongoDB on a Windows system is very simple. Download the executable Installation File (exe) and double-click to install it. : Http://www.mongodb.org/downloads

  • Run the command on the MongoDB server:/bin/mongod.exe
  • Run the command on the MongoDB client:/bin/cmd.exe
2. Install MongoDB in Linux Ubuntu

The Linux system used in this article is Ubuntu 12.04.2 LTS 64bit. you can install the MongoDB database package through apt-get. However, we need to install the official MongoDB software source.

Modify the source. list file of apt and add the 10gen setting.

# Download the key file ~ Sudo apt-key adv -- keyserver hkp: // keyserver.ubuntu.com: 80 -- recv 7F0CEB10Executing: gpg -- ignore-time-conflict -- no-options -- no-default-keyring -- secret-keyring/tmp. kVFab9XYw0 -- trustdb-name/etc/apt/trustdb. gpg -- keyring/etc/apt/trusted. gpg -- primary-keyring/etc/apt/trusted. gpg -- keyserver hkp: // keyserver.ubuntu.com: 80 -- recv 7F0CEB10gpg: Download the key '7f0ceb10' from the hkp server keyserver. ubuntu. comgpg: Key 7F0CEB10: Public Key "Richard Kreuter
  
   
"Imported gpg: no key that is absolutely trusted is found. gpg: Total number of processes: 1gpg: imported: 1 (RSA: 1) # in source. add MongoDB source configuration in list ~ Echo 'Destroy http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen '| sudo tee/etc/apt/sources. list. d/mongodb. listdeb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen # update software source ~ Sudo apt-get update
  

Install MongoDB in Linux Ubuntu

# Install the MongoDB Server ~ Sudo apt-get install mongodb-10gen

After the installation is complete, the MongoDB server will automatically start. We check the MongoDB server program.

# Check the system process of the MongoDB server ~ Ps-aux | grep sans MongoDB 6870 3.7 0.4 349208 39740? Ssl/usr/bin/mongod -- config/etc/mongodb. conf # Check the MongoDB server status through the startup command ~ Netstat-nlt | grep 27017tcp 0 0 0.0.0.0: 27017 0.0.0.0: * LISTEN # Run the startup command to check the MongoDB server status ~ Sudo/etc/init. d/mongodb statusRather than invoking init scripts through/etc/init. d, use the service (8) utility, e.g. service mongodb statusSince the script you are attempting to invoke has been converted to anUpstart job, you may also use the status (8) utility, e.g. status mongodbmongodb start/running, process 6870 # Check the MongoDB server status through system services ~ Sudo service mongodb statusmongodb start/running, process 6870

View the status of the MongoDB server on the web console. Enter http: // ip: 28017 in the browser to open the web console.

3. Access MongoDB through the command line Client

After the MongoDB server is installed, the MongoDB command line client program is automatically installed together.

Enter the mongo command on the local machine to start the instance. The client program accesses the MongoDB server.

~ MongoMongoDB shell version: 2.4.9connecting to: testWelcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/Questions ? Try the support group http://groups.google.com/group/mongodb-user# View Command Line help> help db. help () help on db methods db. mycoll. help () help on collection methods sh. help () sharding helpers rs. help () replica set helpers help admin administrative help connect ing to a db help keys key shortcuts help misc things to know help mr mapreduce show dbs show database names show collections in current database show users show users in current database show profile show most recent system. profile entries with time> = 1 ms show logs show the accessible logger names show log [name] prints out the last segment of log in memory, 'global' is default use
  
   
Set current database db. foo. find () list objects in collection foo db. foo. find ({a: 1}) list objects in foo where a = 1 it result of the last line evaluated; use to further iterate DBQuery. shellBatchSize = x set default number of items to display on shell exit quit the mongo shell
  

The MongoDB server allows external access by default. In this way, we have successfully installed MongoDB in Linux Ubuntu.

MongoDB details: Click here
MongoDB: Click here

Reading:

MongoDB backup and recovery http://www.linuxidc.com/Linux/2012-07/64113.htm

CentOS compiling and installing MongoDB http://www.linuxidc.com/Linux/2012-02/53834.htm

CentOS compilation and installation of php extension http://www.linuxidc.com/Linux/2012-02/53833.htm for MongoDB and mongoDB

CentOS 6 install MongoDB with yum and configure http://www.linuxidc.com/Linux/2012-08/68196.htm on the server side

Install MongoDB2.4.3 http://www.linuxidc.com/Linux/2013-05/84227.htm in Ubuntu 13.04

How to create a new database and a collection http://www.linuxidc.com/Linux/2013-06/85749.htm in MongoDB

MongoDB entry must read (both concepts and practices) http://www.linuxidc.com/Linux/2013-07/87105.htm

MongoDB authoritative Guide (The Definitive Guide) English version [PDF] http://www.linuxidc.com/Linux/2012-07/66735.htm

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.