Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to close database instance in mongodb

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

What this article shares to you is about how to close the database instance in mongodb, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

One: use the mongod command to close

[mongod@localhost journal] # mongod-- shutdown-f / etc/mongodb.conf

Killing process with pid: 17234

Note: the shutdown option of the mongod command shuts down the MongoDB service cleanly.

Two: log in to the admin library and execute db.shutdown ()

/ usr/bin/mongo-port=27017-host=10.1.82.6-username=root-password=root-authenticationDatabase admin

Use admin

Db.shutdownServer ()

Three: use the kill command

View mongo related processes

[mongod@localhost journal] # ps-ef | grep mongo

Root 17573 14213 0 05:10 pts/1 00:00:00 su-mongo

Mongo 17574 17573 0 05:10 pts/1 00:00:00-bash

Mongo 18288 1 0 06:12? 00:00:00 mongod-f / database/mongodb/data/mongodb_27017.conf

Mongo 18300 17574 6 06:13 pts/1 00:00:00 ps-ef

Mongo 18301 17574 0 06:13 pts/1 00:00:00 grep mongo

Kill mongo service process

[mongod@localhost journal] # kill 18288

[mongod@localhost journal] # ps-ef | grep pmon

Mongo 18304 17574 0 06:13 pts/1 00:00:00 grep pmon

Note: you can use the kill command of the operating system to send SIGINT or SIGTERM signals to the mongod process

That is, "kill-2 PID," or "kill-15 PID".

It is recommended that you do not use "kill-9 pid", because if MongoDB is running without logging (--journal)

The above is how to close the database instance in mongodb. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report