MongoDB installation configuration on Windows and Linux platforms

Source: Internet
Author: User
Tags mongodb version

Configuration and Environment:

Win10 (native) and Linux (CENTOS7) intranet servers each.

MongoDB version: 3.07


One, Windows installation MongoDB

1. First download MONGO from official website. I am win7 64bit so download this version.

Links: https://www.mongodb.org/downloads#production

2. Create a Data Catalog

MongoDB stores the data directory in the DB directory. However, this directory is not actively created and needs to be created by itself. I set up db under D:\data\: that's D:\data\db.

3. Test whether it works properly

For convenience, the MongoDB Bin directory is added to the environment variable, that is, the path to add D:\wnmp\MongoDB\Server\3.0\bin;

Then run Mongod.exe--dbpath D:\data\db

            If successful, the following message appears:

2015-11-24t13:17:58.830+0800 i journal  [initandlisten] journal dir=d:\data\db\ Journal2015-11-24t13:17:58.831+0800 i journal  [initandlisten] recover : no  journal files present, no recovery needed2015-11-24t13:17:58.868+0800 i  journal  [durability] durability thread started2015-11-24t13:17:58.869+0800  I JOURNAL  [journal writer] Journal writer thread  Started2015-11-24t13:17:58.947+0800 i control  [initandlisten] mongodb starting  : pid=66628 port=27017 dbpath=d:\data\db 64-bit host=fykknd-pc2015-11-24t13 : 17:58.947+0800 i control  [initandlisten] targetminos: windows 7/windows  server 2008 r22015-11-24t13:17:58.947+0800 i control  [initandlisten]  db version v3.0.72015-11-24t13:17:58.947+0800 i control  [initandlisten] git version:  6ce7cbe8c6b899552dadd907604559806aa2e9bd2015-11-24t13:17:58.947+0800 i control  [ Initandlisten] build info: windows sys.getwindowsversion (Major=6, minor=1, build =7601, platform=2, service_pack= ' service pack 1 ')  boost_lib_version=1_492015-11-24t13 : 17:58.948+0800 i control  [initandlisten] allocator: tcmalloc2015-11-24t13 :17:58.948+0800 i control  [initandlisten] options: { storage: {  dbpath:  "D:\data\db"  } } ... 2015-11-24t13:17:58.976+0800 i storage  [initandlisten]2015-11-24t13:17:58.977+0800 i  NETWORK  [initandlisten] waiting for connections on port  27017 ...


for the sake of convenience, we will start this service as Windows.

Mongod.exe--logpath "D:\data\dblog\mongodb.log"--logappend--dbpath "D:\data\db"--port--servicename "MongoDB"-- Servicedisplayname "MongoDB"--install

Description


--logpath Log Storage Path

--logappend Write Log with Append method

--servicename Service Name

The--servicedisplayname service name, which is executed when there are multiple MongoDB services.

--install as a Windows service installation


There are also some optional parameters:

--BIND_IP Binding IP: We bind the port of the machine 0.0.0.0 by default for local and other machine access. If you only want local access, add the--bind_ip 127.0.0.1 parameter.

--port Port: Default listener 27017 port, if you want to modify, add--port 27018 or other port


After you add a service, you should see it in Task Manager

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/76/74/wKioL1ZT9lDwxhFMAACk9PKta6w255.png "title=" MONGO process "alt=" Wkiol1zt9ldwxhfmaack9pkta6w255.png "/>


If you want to modify the parameters in the service, you need to open the registry for modification:

Run regedit, find Hkey_local_machine\system\currentcontrolset\services\mongodb Below a ImagePath, modify this value.


Second, Linux installation MONGO

1. Download

Still on the official website of the above download

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/76/74/wKioL1ZT-ALBibjcAAF39rVmg0U430.png "title=" Download Linux version MongoDB "alt=" Wkiol1zt-albibjcaaf39rvmg0u430.png "/>

2. Installation

After download, unzip is available directly. The default is no configuration file, and later on how to configure the file.

Also, for convenience, add the MONGO executable file directory to the environment variable:

# Export path= $PATH:/usr/local/mongodb/bin/


Start the test if it is available:

# Mongod


Note: This article is the main reference source http://www.runoob.com/mongodb/mongodb-window-install.html .

This article is from the "Technology Growth drip" blog, please be sure to keep this source http://fykknd.blog.51cto.com/3175618/1716343

MongoDB installation configuration on Windows and Linux platforms

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.