Install Mongodb for windows & amp; pymongo to install eclipse and mongodbforwindows

Source: Internet
Author: User
Tags install mongodb mongoclient mongodb server

Install eclipse in Mongodb for windows & pymongo, and mongodbforwindows

Download

MongoDB provides a pre-compiled Binary Package for 32-bit and 64-bit systems, you can download and install from the MongoDB official website, MongoDB pre-compiled Binary Package: http://www.mongodb.org/downloads

  • MongoDB for Windows 64-bit is suitable for 64-bit Windows Server 2008 R2, Windows 7, and the latest Windows system.
  • MongoDB for Windows 32-bit is suitable for 32-bit Windows and the latest Windows Vista. The maximum MongoDB database size on a 32-bit system is 2 GB.
  • 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.

Download the. msi file, double-click the file, and follow the instructions to install it.

Note: The following addresses (highlighted with a gray background) need to be modified based on your actual installation.

 

Create a data directory

MongoDB stores the data directory in the db directory. However, this data directory is not automatically created. We need to create it after the installation is complete. Note that the data directory should be placed under the root directory (for example, C: \ or D ). You can create these directories in the resource manager of window or through the command line. I have created a data folder in D: \ and a db folder in the data folder.

Run the following command on the MongoDB Server:

To run the mongodbserver under the command prompt, you must execute the mongod.exe file from the bindirectory of the mongodbdirectory.

Quick Start Command Prompt: win + R Enter cmd and press Enter. Find the mongodb installation location and copy the bin directory. The installation directory is 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

 

Run the MongoDB server as a Windows Service

Note that you must have administrative permissions to run the following commands. Run 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

 

Start the mongodb service directly at next boot.

Net start "YourServiceName", open the task manager to view the process

Disable services and delete Processes

D: \ Program Files \ MongoDB \ Server \ 3.2 \ bin> NET stop "YourServiceName" (disable the 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 that it is not -- install)

The following table lists mongodb instances.Startup parameters:

Parameters

Description

-- Bind_ip

Bind a service IP address. If it is bound to 127.0.0.1, only local access is allowed.

-- Logpath

Set the MongoDB log file. Note that the specified file is not a directory.

-- Logappend

Use the append method to write logs

-- Dbpath

Specify database path

-- Port

Specify the service port number. The default port is 27017.

-- ServiceName

Service name

-- ServiceDisplayName

Specify the service name, which is executed when multiple mongodb services exist.

-- Install

Specify to be installed as a Windows service.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

MongoDB background management Shell

If you are logged on to the apsaradb for MongoDB console, you can open the bindirectories under the apsaradb for MongoDB installation directory and then execute the mongo.exe file. MongoDB Shell is an interactive Javascript shell provided by apsaradb for MongoDB to operate and manage apsaradb for MongoDB.

When you enter the mongoDB background, it will be linked to the test document (database) by default ):

You can insert some simple records and find them: Enter exit or ctrl + C to exit.

from pymongo import MongoClientconn = MongoClient("localhost", 27017)db = conn.testprint(db.name)

 

Install the pymongo extension in python in windows

Enter python in the command line to view the local installation version.

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

1. Download options:

Pymongo-XXXX.ar.gz Source

Pymongo-XXXXXX.exe MS Windows installer

2. Install py213-1.11.tar.gz first

3. decompress the package and run the following command in cmd:

cd /d d:\pymongo-xxxxd:\pymongo-xxx>python setup.py install

4.install .exe directly after successful compilation. The python installation path is automatically entered during the process. Go directly to the next step and install it in a silly way.

Test connection:

From pymongo import MongoClient

Conn = clientclient ("localhost", 27017)

Db = conn. test

Print db. name

If you need to configure and install pydev + pymong in eclipse, add the Python directory (the .tar.gz package downloaded before) to Window> Preferences> PyDev> Interpreter-Python> libraries)

 

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.