DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Loading XML into MongoDB
  • Mastering Full-Stack Development: A Comprehensive Beginner’s Guide to the MERN Stack
  • How To Perform Data Migration in MongoDB Using Node.js
  • Leveraging AI and Vector Search in Azure Cosmos DB for MongoDB vCore

Trending

  • Customer 360: Fraud Detection in Fintech With PySpark and ML
  • Teradata Performance and Skew Prevention Tips
  • Beyond Linguistics: Real-Time Domain Event Mapping with WebSocket and Spring Boot
  • How to Format Articles for DZone
  1. DZone
  2. Data Engineering
  3. Databases
  4. Configure a Windows Service for MongoDB

Configure a Windows Service for MongoDB

Let's take a look at a brief tutorial that gives an explanation on how to set up MongoDB as a Windows service.

By 
Anoop Kumar Sharma user avatar
Anoop Kumar Sharma
DZone Core CORE ·
Updated Oct. 19, 18 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
17.4K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, we will learn how to configure a Windows Service for MongoDB. In the previous article of this series, we learned:

  • Getting Started with MongoDB

During Installation of MongoDB, we didn’t check Install MongoD as a service option as I want to show you, How to do the same with the help of command prompt so that It will be easier to learn the basic steps.

Let’s Begin

1. Run Services.msc command and check MongoDB service is installed or not. As we didn’t install that service during the installation, you will not able to find in the services window.

2. Now, open the command prompt with admin rights as we are going to install or configure a windows service for MongoDB.

3. Create a log folder in the drive so that each log can be captured. We already saw how to store a database at a particular location in a previous article of this series.

4. Now add MongoDB.cfg file and add the location of the database (db) and the path where you want to log all the loggings of the MongoDB.

Add the below lines in the config file.

5. After that, we have to install windows service for MongoDB. We can check the options available for the MongoD command with the use of –help.

Run the below command in order to install the windows service for the MongoDB.

mongod --config "C:\MongoFiles\data\mongodb.cfg" –install

6. You will see MongoDB service is now installed in the services window.


7. Run “net start mongodb” command In order to run MongoDB Service. You will get a success message if the service started successfully.

and MongoDB Service will be shown in running status in services window.

8. Let’s hit Mongo shell command in another terminal in order to check the connection with the database.

9. You can also stop the service with “net stop mongodb” command.

Check services window and you found that the service is stopped successfully. 

10. In case you want to delete the service from the Windows Service window, then run the “sc.exe delete MongoDB” command in the command prompt. In the next article, we will learn about the database in MongoDB.

Hope this will help you. Thanks!

MongoDB

Published at DZone with permission of Anoop Kumar Sharma, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Loading XML into MongoDB
  • Mastering Full-Stack Development: A Comprehensive Beginner’s Guide to the MERN Stack
  • How To Perform Data Migration in MongoDB Using Node.js
  • Leveraging AI and Vector Search in Azure Cosmos DB for MongoDB vCore

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!