Clustering with Mongo?

General Discussion
  • #1


    We got our forum migrated to NodeBB.
    And now we are wondering about clustering.

    Our setup is NodeBB v0.6.x and Mongo as the database.

    The docs say that Redis is necessary for clustering, but I can't find any info on how to add a Redis instance into an existing NodeBB+Mongo setup.
    Anyone have experience on this?

    Also will the Redis requirement for clustering still be there in 0.7.0?
    0.7.0 looks really promising, and we'll definitely update once it's stable.

  • GNU/Linux

    @tekojo Redis is required for clustering because stores session data in-memory (that is, tied to each NodeBB process).

    So in a nutshell, user A doesn't always get sent to server X (depending on the load balancer setup, anyway), and in cases where a handshake is established only on one server and not the other, you get weird behaviour. has a Redis adapter, which can be used to store the sessions apart from NodeBB itself.

    To define, add a redis section to your config.json:

        "database": "mongo",
        "port": [4569, 4570],
        "mongo": {
        	.. your regular mongodb connection hash goes here
        "redis": {
            "host": "",
            "port": "6379",
            "password": "",
            "database": "0"

    ... because database is set to mongo, NodeBB will save application data in MongoDB, and auto-detects Redis availability and uses it for session data if at all possible.

  • #3

    @julian so it should work by just adding the redis to the config?
    Even if the current system is all mongo?

    We'll test next week and see how it goes.

  • NodeBB

    Yeah it will work by just adding the redis section. Let us know if you run into any issues.

  • #5

    @baris thanks, we'll do some internal testing on Monday.

  • Plugin & Theme Dev

    @tekojo don't forget to install redis, connect-redis & modules

    npm install redis connect-redis

  • #7

    @pichalite we are running a cluod system, where we actually need to add those to packages. Basically a similar situation as with the heroku install. (Btw That's a really good page in the docs)

Suggested Topics

  • 0 Votes
    8 Posts

  • Clustering

    General Discussion
    -2 Votes
    3 Posts

  • 0 Votes
    2 Posts

  • 0 Votes
    4 Posts

  • 0 Votes
    9 Posts

| | | |