MongoDB best configuration for a Forum with more than 100k users and 200k topics.


  • Admin

    Yeah 24gb should be more than enough unless you have more indices than that which is unlikely.

    Those errors in the cli look like you have a user and password setup but you are not authorizing. You will need to run db.auth(username, password) before running the commands.

    As for cluster you can either run nodebb with ./nodebb start cluster=4 to start 4 nodebb processes or you can put that setting your config.json file as "cluster": 4.

    Is the cpu constantly at 99% even when not doing anything? Or is it on certain routes?



  • Thanks @baris for your reply.

    Now I have 2 issues:

    writin db auth I get

    2014-11-06T08:28:27.812+0100 ReferenceError: nodebb is not defined
    

    Enabling clustering with cluster=8 cause I have 8 cores NodeBB start having lots of issues.
    Options not savings, a message appearing/disappearing continuosly with a reference to unable to connect or similar (I can't read the message cause it's firing too fast.
    In the admin there is a spinner running all the time in the nav bar.

    If I disable clustering it starts working again.



  • Now I fixed the auth issue, but the problem remains with the command

     > MongoDB shell version: 2.6.5
     connecting to: test
     > use nodebb
     switched to db nodebb
     > db.auth('myuser','mypass')
     1
     > db.collection.totalIndexSize()
     > db.collection.stats()
    { "ok" : 0, "errmsg" : "Collection [nodebb.collection] not found." }


  • Ok. The problem was the .collection

    > db.stats()
    {
        "db" : "nodebb",
        "collections" : 5,
        "objects" : 10950579,
        "avgObjSize" : 559.5723418825617,
        "dataSize" : 6127641136,
        "storageSize" : 7159541760,
        "numExtents" : 28,
        "indexes" : 9,
        "indexSize" : 2563102416,
        "fileSize" : 10666115072,
        "nsSizeMB" : 16,
        "dataFileVersion" : {
                "major" : 4,
                "minor" : 6
        },
        "extentFreeList" : {
                "num" : 0,
                "totalSize" : 0
        },
        "ok" : 1
    }

  • Admin

    You can also run db.objects.stats() if I'm not mistaken.



  • The problem is on the Category cause I have a lot of them.

    What about the other issue with the cluster=8?


  • Admin

    @andreapernici said:

    Options not savings, a message appearing/disappear

    For cluster to work properly you will need to configure redis for socket.io.

    You can add a redis block into config.json with the default settings.



  • @baris mmm I'm using mongo.

    I have to configure also redis together with mongo?

    There is some more extensive docs about it specific to nodebb?

    I found this https://github.com/deedw/mong.socket.io but it is already inside the nodebb packages or I have to install it and then put the configuration inside the nodebb config.json?


  • Admin

    @andreapernici Officially, socket.io contains only an in-memory session adapter (which for obv. reasons won't work with a clustered setup), and a redis session adapter.

    So if you're clustering w/ Mongo, you'll have to set up Redis alongside, and have both mongo and redis configuration hashes in your config.json



  • Ok. I understand.

    I think it's correct. One of the thing I thought about NodeBB was that a good approach was to use Redis for notification etcetc and Mongo for the rest.

    In this case to make a summary:

    • install nodebb on Mongo.
    • create a Redis instance.
    • configure the json file with both mongo and redis references.

    If you have some example feel free to share :D



  • Out of curiosity, why don't you use Redis? the new redis cluster feature let you shard data to multiple servers.


  • Banned

    This post is deleted!



Looks like your connection to NodeBB was lost, please wait while we try to reconnect.