Connect to MongoDB query router for Sharding on a docker container running on windows10

Published

This is a follow up of my previous question. Alex Blex’s solution for connecting to the config servers works great. But I am facing the same issue while connecting to the MongoDB Query router.

Below is the command I am using to create the mongos server

docker run -d -p 40001:27017 -v C:/mongodata/data/db --name QR mongo mongos --configdb rs1/172.30.35.165:30001,172.30.32.73:30002,172.30.42.189:30003 --bind_ip 0.0.0.0 --port 27017

But I get the below error on executing docker exec -it QR mongo -port 27017:-

connecting to:
mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn’t connect to server 127.0.0.1:27017, connection attempt
failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused
by :: No connection could be ma de because the target machine actively
refused it. : [email protected]/mongo/shell/mongo.js:374:17 @(connect):2:6
exception: connect failed exiting with code 1

Below is the replication configuration details for the Config Servers –

config = {
          "_id": "rs1",
          "configsvr": true,
          "members":
            [
                {
                "_id": 0,
                "host": "6ed1d953f979:27019"
                },
                {
                "_id": 1,
                "host": "086f0ef5c955:27019"
                },
                {
                "_id": 2,
                "host": "391c9c07b341:27019"
                }
            ]
        }

Here is the container ID and IP address

------------------------------------------
Server      IP Address      Container ID 
------------------------------------------
asiaCS      172.30.35.165   6ed1d953f979
europeCS    172.30.32.73    086f0ef5c955
americaCS   172.30.42.189   391c9c07b341

I am not sure if I am even configuring the mongos properly.

Source: Docker Questions

Published
Categorised as docker, mongodb, windows-10 Tagged , ,

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq