Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 15479  / 1 Year ago, wed, february 15, 2023, 6:17:35

When I first installed MongoDB 2.2.3 with apt-get, following the instructions from 10gen installation guide, it auto starts when the server starts.



However, after following the instructions in /var/log/mongodb/mongodb.log:



Tue Apr 30 11:35:28.643 [initandlisten] ** WARNING: You are running on a NUMA machine.
Tue Apr 30 11:35:28.643 [initandlisten] ** We suggest launching mongod like this to avoid performance problems:
Tue Apr 30 11:35:28.643 [initandlisten] ** numactl --interleave=all mongod [other options]
Tue Apr 30 11:35:28.643 [initandlisten]
Tue Apr 30 11:35:28.643 [initandlisten] ** WARNING: /proc/sys/vm/zone_reclaim_mode is 1
Tue Apr 30 11:35:28.643 [initandlisten] ** We suggest setting it to 0
Tue Apr 30 11:35:28.643 [initandlisten] ** http://www.kernel.org/doc/Documentation/sysctl/vm.txt
Tue Apr 30 11:35:28.643 [initandlisten]


it doesn't auto start any more.



So now I have to enter:



echo 0 > /proc/sys/vm/zone_reclaim_mode && numactl --interleave=all /usr/bin/mongod --config /etc/mongodb.conf &


manually every time in a terminal to start it.



However, I suspect starting it this way also causes service mongodb stop/restart to fail. It will throw a stop: Unknown instance: error.



Is there a proper way to resolve this?


More From » upstart

 Answers
1

Upstart cannot stop or restart your service if you started it manually. You need to update the upstart script for mongodb so that it starts with the options you require, and then start it with service mongodb start.



First of all, since the zone_reclaim_mode setting is system-wide rather than specific to mongodb, you could add the line:



vm.zone_reclaim_mode = 0


to /etc/sysctl.conf, which configures system variables on startup.



Next, you need to update the script that upstart uses to start mongodb, /etc/init/mongodb.conf, so that it wraps the normal command with the numactl command. So the line:



if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec  /usr/bin/mongod -- --config /etc/mongodb.conf; fi


becomes:



if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec  /usr/bin/numactl -- --interleave=all /usr/bin/mongod --config /etc/mongodb.conf; fi


You also mention that upstart won't auto-start your service on boot; if that still happens after making the above changes, please attached a full extract from /var/log/mongodb/mongodb.log of a failed start.


[#31277] Thursday, February 16, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
allowiel

Total Points: 189
Total Questions: 103
Total Answers: 105

Location: Slovenia
Member since Thu, Mar 18, 2021
3 Years ago
;