MongoDB (iii) MONGODB installation

Source: Internet
Author: User
Tags install mongodb mongodb client mongodb download win32

MongoDB installed on Windows

On Windows, first to install MongoDB download the latest released mongodb:http://www.mongodb.org/downloads make sure to get the correct version depending on your version of Windows MongoDB. In order to get the Windows version open a command prompt and execute the following command:

c:\>64-bit C>

Only the 32-bit version of the MongoDB database is less than 2GB and is suitable for testing and evaluation purposes only. Now, unzip the downloaded file to c:\drive or anywhere else. Ensure that the extracted folder name is Mongodb-win32-i386-[version] or mongodb-win32-x86_64-[version]. [Version] is a download in MongoDB.

Now open a command prompt and run the following command

C:\>move mongodb-win64-* MongoDB      1 dir (s) moved. C>

If you have extracted mondodb in a different location and then go to that path using the command CD Foolder/dir, now run the procedure given above. MongoDB Data folder to store files.

The default location for MongoDB's data directory is c:\data\db. Therefore, you need to use a command prompt to create this folder. Execute the following command sequence

C:\>MD DATAC:\MD data\db

If MongoDB is installed in a different location, then you need to specify any alternate path \data\db by setting the path DBPath to Mongod.exe. For the same issue, the following command, at the command prompt, refers to the bin directory of the MongoDB installation folder. Assume that the installation folder D:\set Up\mongodb

c:\users\xyz>d:d:\>cd "set up"D:\setup >cd mongodbd:\set up\mongodb>CD Bind:\set Up\mongodb\bin

This displays the output connection message on the console waiting to indicate that the Mongod.exe process is running successfully. Now run MongoDB, you need to open another command prompt and issue the following command

D:\set up\mongodb\bin>2.4.6connecting To:test>db.test.save ({a:1 })>" _id ": ObjectId (5879b0f65a56a454)," a ": 1 }>

This will show that MongoDB is successfully installed and running. Next run requires MongoDB to issue commands

D:\set up\mongodb\bin>mongod.exe--dbpath "D:\set up\mongodb\data" D:\set up\mongodb\bin>mongo.exe
MongoDB installed in Ubuntu

Run the following command to import the MongoDB public GPG key:

sudo apt-key adv--keyserver HKP://keyserver.ubuntu.com:80--recv 7f0ceb10

Use the following command to create a/etc/apt/sources.list.d/mongodb.list file

Echo ' Deb Http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen ' | sudo tee/etc/apt/sources.list.d/mongodb.list

Now issue the following command to update the repository:

sudo apt-get update

Now install MongoDB using the following command:

Apt-get Install mongodb-10gen=2.2.3

Installing 2.2.3 on the above is the release of MongoDB. Ensure that the latest version is always installed. MongoDB installation is now successful.

Start MongoDB

sudo service MongoDB start

Stop MongoDB

sudo service MongoDB stop

Restart MongoDB

sudo service MongoDB restart

To run the following command using MongoDB

Mongo

This will connect to the running Mongod instance.

MongoDB Help

To obtain a list of commands for the MongoDB client, you need to enter the command Db.help (). This lists the commands as shown in the following table:

MongoDB Statistical information

To obtain server statistics about MONGODB, you need to type command Db.stats () in the MongoDB client. This will display the database name, blocking the collection and documentation in the database. The output commands are as follows:

MongoDB (iii) MONGODB installation

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.