0

Not sure If I can make the same question already made here but here it goes.

I have a mongodb fork and running with high CPU usage. I'm trying to shut it down but nothing seems to work.

 2729 mwon      20   0 10.080g 9.047g  22668 S  56.2 28.8   4254:11 mongod --dbpath /disk2/db --port 27018 -logpath /disk2/db/mongod.log --fork

I have tried:

mongod --dbpath /disk2/db --shutdown

but it hangs without any kind of response. I also tried:

 kill 2729
 kill -2 2729

The command gets executed but nothing happens. This is the tail of the log:

2019-07-30T15:55:27.757+0000 I NETWORK  [conn13356] end connection 127.0.0.1:45690 (62 connections now open)
2019-07-30T15:55:27.758+0000 I NETWORK  [conn13368] end connection 127.0.0.1:45764 (61 connections now open)
2019-07-30T15:55:27.759+0000 I NETWORK  [conn13380] end connection 127.0.0.1:45826 (60 connections now open)
2019-07-30T15:55:27.764+0000 I NETWORK  [conn13381] end connection 127.0.0.1:45832 (59 connections now open)
2019-07-30T15:55:27.764+0000 I NETWORK  [conn13369] end connection 127.0.0.1:45772 (58 connections now open)
2019-07-30T15:55:27.765+0000 I NETWORK  [conn13344] end connection 127.0.0.1:45628 (57 connections now open)
2019-07-30T15:59:17.043+0000 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2019-07-30T15:59:17.044+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2019-07-30T15:59:17.044+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27018.sock
2019-07-30T16:23:37.773+0000 I NETWORK  [conn11035] end connection 127.0.0.1:48928 (56 connections now open)
  • You can try with kill -15 2729 (15 is TERM (software termination signal)). If that doesn't succeed, then kill -9 2729 surely will ;) (9 is KILL (non-catchable, non-ignorable kill)) Oh, the default is 15 which you already tried and didn't work. – ypercubeᵀᴹ Jul 31 at 12:40
0

Try the below commands:

kill <process id> 
kill -2 <process id> 
kill -SIGHUP <process id>
kill -SIGQUIT <process id> 
kill -SIGTERM <process id> 
kill -SIGKILL <process id>

or

  1. Log on to your database
  2. Switch to admin database
  3. Execute the command db.shutdownServer() to gracefully shutdown mongodb which is the safest way to shut down the DB

Thank you!

-Anban

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.