Redis or MongoDB?



  • Hi there,

    What is best to use? Always hearing bad things about Mongodb and Redis I have been told "redis is usually used for more temporary data store. Things like caching and pub/sub, it is an amazing communication layer for multiple servers/dbs. when you talk about permanent data store like users and things, you almost never use redis for that"

    So those who use either can you please advise me on the best way forward. Any options yet for rethinkDB or mysql?

    Thanks


  • Global Moderator

    Pros and Cons to both, but in a NodeBB environment, both are relatively similar in the long term.

    Redis stores data in RAM, but saves to disk in time/data increments.

    MongoDB just stores data on disk.

    I've been running 35hz.co.uk on Redis for over a year and not had a Redis related issue in all of that time. It's been nothing but stable.

    I've not used MongoDB, but when your site becomes too large for Redis (cost per GB of RAM is higher than cost per GB of SSD storage), a move to MongoDB is always a wise one. (NodeBB.org uses MongoDB now, but used to use Redis (reason for the move was to test their exporter)).

    Choices are entirely yours really. You'll find just as much support for both on the forums.



  • Thanks for the information :)


  • Plugin & Theme Dev

    @nodeSide You can have mongo as your default database and setup redis as secondary for clustering and session management.


  • Admin

    @a_5mith said:

    Pros and Cons to both, but in a NodeBB environment, both are relatively similar in the long term.

    Redis stores data in RAM, but saves to disk in time/data increments.

    MongoDB just stores data on disk.

    I've been running 35hz.co.uk on Redis for over a year and not had a Redis related issue in all of that time. It's been nothing but stable.

    I've not used MongoDB, but when your site becomes too large for Redis (cost per GB of RAM is higher than cost per GB of SSD storage), a move to MongoDB is always a wise one. (NodeBB.org uses MongoDB now, but used to use Redis (reason for the move was to test their exporter)).

    Choices are entirely yours really. You'll find just as much support for both on the forums.

    Well answered, that's exactly right. As an added note, our premium hosting services use both MongoDB and Redis. #magichax just for our paying clients (well okay, it's also in our docs so you can do it yourself)


  • Swedes

    I use Mongodb and it works great ;) Don't know a lot of redis .



  • I can only confirm what @a_5mith said.
    The database of my forum contains over 30k posts and 6k users. Never had any issues with Redis.

    The only thing you have to look after is that you have secured your installation properly and also created a backup deamon (just for the case).


  • Translator

    @psychobunny Do you use Redis as primary or secondary Database?


  • Admin

    We use MongoDB as the primary database, Redis stores websocket data and sessions (transient data)



  • @julian Does the combo config use redis as caching for Mongo as well?


  • Admin

    @Shard I believe that's what I meant to say, unless it didn't come out right? :smile:



  • I do not plan to switch, but is there a documented method to migrate to MongoDB?


  • Translator

    @JaredBusch No but the guys from NodeBB have a migration tool to there disposal.



  • I'm using mongo and its been great even with decent amount of traffic..

    It depends on what your running on.. We have a prod and dev mongodb forum and a 500 slot ts3 server all on the same Ubuntu AWS micro instance!


  • Admin

    @Kowlin said:

    @JaredBusch No but the guys from NodeBB have a migration tool to there disposal.

    Yes, we offer Redis to MongoDB migrations for a $50 flat fee, as it requires a bit of prep work and execution expertise :smile:



  • restart with this error using mongodb after upgrade to 0.9.3:

    20/12 18:04 [2947] - error: MongoError: server 127.0.0.1:27017 sockets closed
        at Server.destroy (/path/to/nodebb/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:676:47)
        at Server.close (/path/to/nodebb/node_modules/mongodb/lib/server.js:367:17)
        at Db.close (/path/to/nodebb/node_modules/mongodb/lib/db.js:333:19)
        at Object.module.close (/path/to/nodebb/src/database/mongo.js:228:6)
        at shutdown (/path/to/nodebb/app.js:305:28)
        at process.<anonymous> (/path/to/nodebb/app.js:176:3)
        at process.emit (events.js:107:17)
        at process._fatalException (node.js:236:26)
    

    https://github.com/NodeBB/NodeBB/issues/3978

    sohrabafard created this issue in NodeBB/NodeBB

    closed restarting nodebb multiple time #3978



  • @julian

    I guess that depends on what is covered by the word "caching" :)

    I was curious about caching posts, etc. Not "just sessions and websockets.
    "


Log in to reply
 

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