1

I have a mongodb 3.6 replica set. The replica members are running in docker containers. The whole replica set was created as a docker swarm service. Something like this:

docker service create -d \
        --name "mongo-master" \
        --mode global \
    --constraint "node.labels.mongo == master" \
        --network test-internal \
        --endpoint-mode dnsrr \
        --mount type=bind,src=/docker/mongodb/conf,dst=/conf \
        --mount type=bind,src=/docker/mongodb/data/master,dst=/data/db \
        --mount type=bind,src=/docker/mongodb/data/backup,dst=/backup \
        mongo:3.6 -f /conf/rs0.conf

docker service create -d \
        --name "mongo-replica" \
        --mode global \
    --constraint "node.labels.mongo == replica" \
        --network test-internal \
        --endpoint-mode dnsrr \
        --mount type=bind,src=/docker/mongodb/conf,dst=/conf \
        mongo:3.6 -f /conf/rs0.conf

docker service create -d \
        --name "mongo-arbiter" \
        --mode global \
    --constraint "node.labels.mongo == arbiter" \
        --network test-internal \
        --endpoint-mode dnsrr \
        --mount type=bind,src=/docker/mongodb/conf,dst=/conf \
        --mount type=bind,src=/docker/mongodb/data/arbiter,dst=/data/db \
        mongo:3.6 -f /conf/rs0.conf

When I start the mongo shell then I get this warning:

MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
Server has startup warnings: 
2018-03-19T08:51:27.726+0000 I CONTROL  [initandlisten] 
2018-03-19T08:51:27.727+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-03-19T08:51:27.727+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-03-19T08:51:27.727+0000 I CONTROL  [initandlisten] 
2018-03-19T08:51:27.727+0000 I CONTROL  [initandlisten] 
2018-03-19T08:51:27.727+0000 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.
2018-03-19T08:51:27.727+0000 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:
2018-03-19T08:51:27.727+0000 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]
2018-03-19T08:51:27.728+0000 I CONTROL  [initandlisten] 
rs0:PRIMARY> 

So I should start the service with numactl. There is an issue about this here:

https://github.com/docker-library/mongo/issues/113

But that solution cannot be used in my case, because the instances are created by docker swarm. E.g. there is no "docker run" command, only "docker service create" command. I cannot specify "--security-opt seccomp=unconfined", or at least I don't know how. I'm using the official docker image from here: https://hub.docker.com/_/mongo/

  • I'm curious if you have solved it? – Keqiang Li May 7 at 22:18
  • I haven't, we are still using it with that warning. – nagylzs May 7 at 22:25
  • I have been using this setting as well but did get an error like: MongoDB topology had an error. Not sure if that was caused by this setting. It seems there is no good way around it using Docker with MongoDB. – Keqiang Li May 8 at 15:31
  • A possibly correct solution is to build your own mongodb docker image that starts the mongo daemon with numactl. I'm not sure why this was not included in the official mongodb image as an option. – nagylzs May 8 at 16:37

Your Answer

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

Browse other questions tagged or ask your own question.