Is Nodebb supporting Atlas Mongodb clusters?



  • Setting up a cluster on Atlas Mongodb.

    My config

    {
        "url": "http://localhost:4567",
        "secret": "dc0b3fff-4312-1234-4321-e5a327824225",
        "database": "mongo",
        "port": "4567",
        "mongo": {
            "host": "cluster0-shard-00-00-z1243.mongodb.net,cluster0-shard-00-01-z1234.mongodb.net,cluster0-shard-00-02-z1234.mongodb.net",
            "port": "27017,27017,27017",
            "username": "dbUser",
            "password": "1234123412341234",
            "database": "somedbname",
            "uri": "mongodb+srv://dbUser:1234123412341234@cluster0-z1234.mongodb.net/somedbname?retryWrites=true"
        }
    }
    

    Changes in the mongo.js file

    ssl: true,
    authSource: 'admin',
    replicaSet: 'Cluster0-shard-0',
    

    I can successfully complete the .\nodebb setup command.
    It also works as expected against local instance of Mongodb but when I run it against Atlas cluster I get:

    not authorized on admin to execute command { create: "socket.io", capped: true, size: 5242880 }"


  • Global Moderator

    @maciejso you shouldn't need to modify any files if you have only the uri property in the mongo object in config.json (assuming the URI is correct)

    Have you tried googling that error? It seems that when nodebb attempts to create a socket.io collection, it doesn't have the necessary privileges. Perhaps trying giving the user that nodebb is using more privileges, or creating that collection or whatever manually?



  • Thanks for the answer.

    Changing the mongodb params came from earlier posts on the forum
    https://community.nodebb.org/topic/10810/connection-to-mongodb-that-is-hosted-on-atlas/6

    I take that I could as well include them directly in the config.sjon as parameters to the uri query.

    Yes, I did spend hours on googling this and similar error messages.

    No, you can't create any collection manually on admin on MongoDb Atlas.
    Neither from CLI nor from web interface.
    Have upgraded from M0 to M2 just to see if there would be any impact but it isn't.

    The most interesting thing is that the collection socket.io on admin was not created on local instance in order to get the nodebb to run. I am able to create it locally but setup did not create it.


Log in to reply
 

Suggested Topics

| |