How to install MongoDB and error 1053 in windows

Source: Internet
Author: User
Tags install mongodb mongodb postgresql redis win32 zip

Install MongoDB

Go to http://www.mongodb.org/to find the Windows 32-bit installation program, which is actually a green program. This document uses mongodb-win32-i386-1.6.0.zip as an example.

Configure to run MongoDB

Decompress the downloaded mongodb compressed package to the target Directory, such as D:/mongodb. Open the cmd command line and enter:

The code is as follows:

D:/mongodb/bin> mongod.exe-dbpath d:/mongodb/db

There is no db folder in the d:/mongodb Directory. You need to create one by yourself. At this time, the mongod process runs and then open a cmd window and enter:

The code is as follows:

D:/mongodb/bin/cmd.exe

Go to mongodb command mode

The code is as follows:

MongoDB Shell Version: 1.6.0
Connection to (databaseName)
> Show dbs
Admin
Local

You can check the database status in advance. By default, there are two databases: admin and local.

>

The code is as follows:

Use testdb; open the database. If not, create one immediately.
> Db. Py. save ({a: 10}); save a message to the collection PC. If there is no collection, create one immediately.

> Db. Py. find (); retrieve all records
{"_ Id": ObjectId ("4c469967dd6f000000001637 & Prime;)," a ": 10}

> Show collections; show all collection names
-
System. indexes;

System usage

Help is a help command. You can run it at any time to view the command prompt.


Configure the MongDB service

To avoid starting MongoDB every time you open the cmd window, you can register it as a service. The cmd command is:

The code is as follows:

D:/mongodb/bin/mongod.exe-dbpath d:/mongodb/db-logpath d:/mongodb/log-install

Although this command can be registered with the windows service, but I encountered a problem that could not be started, the prompt: "Error 1053, the service did not respond to the startup or control request in time ". When I was depressed, I thought of calling bat batch processing with a VBS file to hide the cmd command running in the background.

First, create the bat file:

The code is as follows:
Mongo-start.bat content d:/mongodb/bin/mongod.exe-dbpath = d:/mongodb/db-logpath = d:/mongodb/log
Mongo-stop.bat content taskkill/f/t/im cmdd.exe

Create a vbs file:

The code is as follows:

Mongo-start.vbs:
Set ws = CreateObject ("Wscript. Shell ")
Ws. run "cmd/c d:/mongodb/mongo-start.bat", vbhide

Mongo-stop.vbs:
Set ws = CreateObject ("Wscript. Shell ")
Ws. run "cmd/c d:/mongodb/mongo-stop.bat", vbhide

In this way, you can call the vbs file to start and stop MongoDB and run it in the background.


MongoDB installation error 1053 solved

Download Windows installation package mongodb-win32-i386-2.4.0.zip: http://www.mongodb.org/downloads

Decompress the package to disk D:/mongoDB, and create two folders in mongoDB: data and logs, because you need to specify the data storage

Logs directory, which is not automatically created.

Then run the CMD command line to install mongoDB to the system service:

The code is as follows:

> D:/mongoDB/bin/mongod.exe -- bind_ip 127.0.0.1 -- logpath D:/mongodb/logs/mongodb. log -- logappend -- dbpath "D:/mongodb/data" -- directoryperdb -- serviceName MongoDB -- install

Start:> net start MongoDB

Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

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.