MongoDB installation for Windows & Pymongo installation Eclipse

Source: Internet
Author: User
Tags mongoclient mongodb server

Download

MONGODB provides pre-compiled binaries for both 32-bit and 64-bit systems, which you can download from MongoDB website, MongoDB precompiled binary package: Http://www.mongodb.org/downloads

    • MongoDB for Windows 64-bit is suitable for 64-bit Windows Server R2, Windows 7, and the latest version of the Window system.
    • MongoDB for Windows 32-bit is suitable for 32-bit Window systems and the latest Windows Vista. MongoDB databases on 32-bit systems have a maximum of 2GB.
    • MongoDB for Windows 64-bit Legacy is suitable for 64-bit Windows Vista, Windows Server 2003, and Windows Server 2008.
    • MongoDB for Windows 64-bit Legacy is suitable for 64-bit Windows Vista, Windows Server 2003, and Windows Server 2008.

After you download the. msi file, double-click the file and follow the instructions to install it.

Note : Some of the following addresses (which I highlighted with a gray background) will need to be modified depending on your actual installation situation.

Create Data Catalog

MongoDB stores the data directory in the DB directory. However, this data directory is not actively created, and we need to create it after the installation is complete. Note that the data directory should be placed under the root directory (e.g. C: \ or D:\. , etc.). These directories can be created through the Windows Explorer or through the command line. I created a new data folder in D:\ and created a new DB folder in the Data folder.  

command line to run the MongoDB server:

In order to run the MongoDB server from the command prompt, you must execute the Mongod.exe file from the bin directory of the MongoDB directory.

Quick Start command prompt: win+r input cmd Enter, find the installation location of MongoDB Copy bin directory, I install directory: D:\Program files\mongodb\server\3.2\bin

1 cd/d D:\Program files\mongodb\server\3.2\ bin2 mongod.exe--dbpath d:\data\db

to run the MongoDB server as a Windows service

Note that you must have administrative privileges to run the following command. Execute the following command to run the MongoDB server as a Windows service:

Mongod.exe--bind_ip "uripadres" --logpath "D:\data\dbConf\mongodb.log" --logappend--dbpath "D : \data\db " --port yourportnumber--servicename " yourservicename " --servicedisplayname" Yourservicename " –install

Next boot direct start MongoDB service

NET START "Yourservicename", Open Task Manager View process

Shutting down services and deleting processes

D:\Program files\mongodb\server\3.2\bin>net Stop "Yourservicename" (shutdown Service)

D:\Program files\mongodb\server\3.2\bin> mongod.exe--bind_ip "uripadres" --logpath "d:\data\dbConf\ Mongodb.log " --logappend--dbpath " d:\data\db " --port yourportnumber --servicename " Yourservicename "--servicedisplayname " Yourservicename " --remove --servicename " Yourservicename " (delete, note not--install)

The following table is the MongoDB parameter description for startup:

Parameters

Describe

--bind_ip

Bind service IP, if bind 127.0.0.1, can only native access, do not specify default local all IP

--logpath

Specify the MongoDB log file, note that the specified file is not a directory

--logappend

Write a log using an Append method

--dbpath

Specify the database path

--port

Specifying the service port number, default port 27017

--servicename

Specify the service name

--servicedisplayname

Specifies the service name that is executed when there are multiple MongoDB services.

--install

Specifies the installation as a Windows service.

MongoDB Background Management Shell

If you need to get into MongoDB background management, you need to open the bin directory of the MongoDB installation directory first, then execute the mongo.exe file, MongoDB Shell is the interactive JavaScript shell that comes with MongoDB, An interactive environment for manipulating and managing MongoDB

When you enter MongoDB background, it is linked to the test document (database) by default:

You can insert a few simple records and find it: Enter exit or CTRL + C to exit.

= Mongoclient ("localhost"27017= conn.testprint (db.name)

Python installation Pymongo extensions under Windows

command line enter Python to view the native installation version.

http://pypi.python.org/pypi/pymongo/#downloads

1. Download options:

Pymongo-xxxx.ar.gz Source

Pymongo-xxxxxx.exe MS Windows Installer

2. First install the pymongo-1.11.tar.gz

3. After decompression, CMD runs the statement:

cd/d d:\pymongo-xxxxd:\pymongoInstall

4. After the compilation succeeds, install the. exe directly, and the Python installation path is automatically populated during the process. Direct Next, fool-mounted.

To test the connection:

From Pymongo import mongoclient

conn = Mongoclient ("localhost", 27017)

db = Conn.test

Print Db.name

If you need to configure the installation in Eclipse using Pydev+pymong, the window->preferences->pydev->interpreter-python-> Libraries add Pymongo directory (previously downloaded. tar.gz package decompression)

MongoDB installation for Windows & Pymongo installation Eclipse

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.