I am running mongodb as an external process from node.js and I want to
be able to shut it down and restart it on demand.
If I type Ctrl-C into the shell running node.js then node.js shuts
down and mongo shuts down cleanly under it.
If I run mongoprocess.kill() from node.js then mongodb crashes out.
This is not unexpected because this sends SIGTERM which is documented
to close mongodb in an uncontrolled manner.
If I run mongoprocess.kill("SIGINT") from node.js then this also
crashes out despite assurances in the mongodb documentation that this
should cause a clean exit.
Upon restarting the mongodb process I get the following message.
mongodb_0 stdout: Thu Mar 01 09:41:15 [initandlisten] ** NOTE: when
using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Thu Mar 01 09:41:15 [initandlisten] ** see
http://blog.mongodb.org/post/137788967/32-bit-limitations
Thu Mar 01 09:41:15 [initandlisten] ** with --journal, the limit
is lower
Thu Mar 01 09:41:15 [initandlisten]
Thu Mar 01 09:41:15 [initandlisten] db version v2.0.2, pdfile version
4.5
Thu Mar 01 09:41:15 [initandlisten] git version:
514b122d308928517f5841888ceaa4246a7f18e3
Thu Mar 01 09:41:15 [initandlisten] build info: windows (5, 1, 2600,
2, 'Service Pack 3') BOOST_LIB_VERSION=1_42
Thu Mar 01 09:41:15 [initandlisten] options: { dbpath: "C:\Users
\andrewb\Documents\Prog\IcedAPIServer\data\mongodata" }
**************
Unclean shutdown detected.
Please visit
http://dochub.mongodb.org/core/repair for recovery
instructions.
*************
Thu Mar 01 09:41:15 [initandlisten] exception in initAndListen: 12596
old lock file, terminating
Thu Mar 01 09:41:15 dbexit:
Thu Mar 01 09:41:15 [initandlisten] shutdown: going to close listening
sockets..
.
Thu Mar 01 09:41:15 [initandlisten] shutdown: going to flush
diaglog...
Thu Mar 01 09:41:15 [initandlisten] shutdown: going to close
sockets...
Thu Mar 01 09:41:15 [initandlisten] shutdown: waiting for fs
preallocator...
Thu Mar 01 09:41:15 [initandlisten] shutdown: closing all files...
Thu Mar 01 09:41:15 [initandlisten] closeAllFiles() finished
Thu Mar 01 09:41:15 dbexit: really exiting now
Is there a simple way to shut down mongodb without going via its
network interface? Is there a reason why SIGINT does not seem to work
as it should in this particular case? Clearly it works when I type
Ctrl-C.
Thanks,
Andy