Skip to content

Commit 6f0fd3d

Browse files
authored
Merge pull request #138 from infosiftr/mongos
mongos is also valid target for stepping down and numactl
2 parents 310529f + 4a81205 commit 6f0fd3d

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

3.0/docker-entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ if [ "${1:0:1}" = '-' ]; then
66
fi
77

88
# allow the container to be started with `--user`
9-
if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then
10-
chown -R mongodb /data/configdb /data/db
9+
# all mongo* commands should be dropped to the correct user
10+
if [[ "$1" == mongo* ]] && [ "$(id -u)" = '0' ]; then
11+
if [ "$1" = 'mongod' ]; then
12+
chown -R mongodb /data/configdb /data/db
13+
fi
1114
exec gosu mongodb "$BASH_SOURCE" "$@"
1215
fi
1316

14-
if [ "$1" = 'mongod' ]; then
17+
# you should use numactl to start your mongod instances, including the config servers, mongos instances, and any clients.
18+
# https://docs.mongodb.com/manual/administration/production-notes/#configuring-numa-on-linux
19+
if [[ "$1" == mongo* ]]; then
1520
numa='numactl --interleave=all'
1621
if $numa true &> /dev/null; then
1722
set -- $numa "$@"

3.2/docker-entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ if [ "${1:0:1}" = '-' ]; then
66
fi
77

88
# allow the container to be started with `--user`
9-
if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then
10-
chown -R mongodb /data/configdb /data/db
9+
# all mongo* commands should be dropped to the correct user
10+
if [[ "$1" == mongo* ]] && [ "$(id -u)" = '0' ]; then
11+
if [ "$1" = 'mongod' ]; then
12+
chown -R mongodb /data/configdb /data/db
13+
fi
1114
exec gosu mongodb "$BASH_SOURCE" "$@"
1215
fi
1316

14-
if [ "$1" = 'mongod' ]; then
17+
# you should use numactl to start your mongod instances, including the config servers, mongos instances, and any clients.
18+
# https://docs.mongodb.com/manual/administration/production-notes/#configuring-numa-on-linux
19+
if [[ "$1" == mongo* ]]; then
1520
numa='numactl --interleave=all'
1621
if $numa true &> /dev/null; then
1722
set -- $numa "$@"

3.4/docker-entrypoint.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ if [ "${1:0:1}" = '-' ]; then
66
fi
77

88
# allow the container to be started with `--user`
9-
if [ "$1" = 'mongod' -a "$(id -u)" = '0' ]; then
10-
chown -R mongodb /data/configdb /data/db
9+
# all mongo* commands should be dropped to the correct user
10+
if [[ "$1" == mongo* ]] && [ "$(id -u)" = '0' ]; then
11+
if [ "$1" = 'mongod' ]; then
12+
chown -R mongodb /data/configdb /data/db
13+
fi
1114
exec gosu mongodb "$BASH_SOURCE" "$@"
1215
fi
1316

14-
if [ "$1" = 'mongod' ]; then
17+
# you should use numactl to start your mongod instances, including the config servers, mongos instances, and any clients.
18+
# https://docs.mongodb.com/manual/administration/production-notes/#configuring-numa-on-linux
19+
if [[ "$1" == mongo* ]]; then
1520
numa='numactl --interleave=all'
1621
if $numa true &> /dev/null; then
1722
set -- $numa "$@"

0 commit comments

Comments
 (0)