MongoDB server setup on Azure VM Linux machine

MRvLuijpen
MRvLuijpen Partner, L2 Admin, L2 Designer, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Frontrunner 2022 Participant, Neuron 2023 Posts: 107 Neuron

Hello Community,

I am experimenting a bit with all kinds of data connections (MS SQL Server, MySQL, PostgreSQL, Snowflake) and have set up a MongoDB Server running on the same Azure machine as my DSS is running. A database and user are set up on the MongoDB, but a connection towards the MongoDB results in the following time out error :

Connection failed: Could not connect to server: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=##.##.##.##:####, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]

Hope someone can help me with this.

Thanks in advance

Marc Robert

And perhaps this can be also be added to the course https://academy.dataiku.com/integration-with-mongodb

Answers

  • NicolasM
    NicolasM Dataiker, Dataiku DSS Core Designer Posts: 3 Dataiker

    Hi Marc,

    By default MongoDB only accepts connection from localhost. As both your DSS and MongoDB are on the same instance, did you try connecting with localhost rather than with your ##.##.##.## address?

  • MRvLuijpen
    MRvLuijpen Partner, L2 Admin, L2 Designer, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Frontrunner 2022 Participant, Neuron 2023 Posts: 107 Neuron
    edited July 17

    Hello @NicolasM
    ,

    I tried that as well, and this also resulted in an error :

     Connection failed: Could not connect to server: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='#####', source='#####', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server localhost:####. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }}}]

  • MRvLuijpen
    MRvLuijpen Partner, L2 Admin, L2 Designer, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Frontrunner 2022 Participant, Neuron 2023 Posts: 107 Neuron

    In addition to the last message, I was able to connect to the MongoDB with VS Code on the Linux machine with the user & password. Might the Azure cause the connecting problem?

  • NicolasM
    NicolasM Dataiker, Dataiku DSS Core Designer Posts: 3 Dataiker

    This error message is different, and the good news is that DSS can now reach the database but you have an authentication issue.

    Can you double check the details (database name, user and password) that you entered in the connection?

  • MRvLuijpen
    MRvLuijpen Partner, L2 Admin, L2 Designer, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Dataiku DSS Adv Designer, Registered, Dataiku DSS Developer, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Frontrunner 2022 Participant, Neuron 2023 Posts: 107 Neuron

    Hello @NicolasM
    ,

    I have checked several times that I am using the same user id & password, without success.

  • NicolasM
    NicolasM Dataiker, Dataiku DSS Core Designer Posts: 3 Dataiker

    Did you try to connect from the mongo shell rather than from DSS to your MongoDB server? (see https://docs.mongodb.com/manual/mongo/)

    Also I would try to create another user/password and try to connect with this one.

Setup Info
    Tags
      Help me…