Multiple processes. Is Redis required?
-
If I try to run multiple processes (ports), I get the error
Error: [[error:redis-required-for-pubsub]]
The documentation says
When you setup NodeBB to use more than one process, it is advisable to configure Redis as well. Each NodeBB process can communicate with the others through Redis pub-sub.
Is Redis advisable or is it required?
-
@streaps it's required now when running with multiple processes
-
Redis is used to store sessions, so everyone would probably be logged out if you lost the database. But no actual forum data would be lost.
-
@julian said in Multiple processes. Is Redis required?:
@gotwf Yes I believe this still holds true even for psql
Heh, you read my mind, eh?
It has been a while since I tested PostgreSQL. Performance was pretty dismal compared to mongodb so I did not pursue too in depth. I don't recall if I was testing w/multiple processes or not, nor if I still had Redis enabled for session management or not. But if not, maybe that 'splains it?
In any case, I have been meaning to take another gander at it. SSPL is not really a major issue for me but some distros, e.g. Voidlinux, have pulled mongo stuff from their package repos. And I am informed, elastic this and that are soon to follow now that they too have changed to the non OSI approved SSPL license. Maybe Voidlinux is unique. Or maybe they are vanguards of things to come from other distros? Yeah, I know; "Use the source, Luke...". Viable fer' sure, fer' sure but I am trying to work less, not more these days.
-
Just to clear some confusion here, redis is NOT required for the session store it is required for socket.io & pubsub to work properly when using more than 1 nodebb process. So if you want you can use psql or mongodb for session store. Below is a config.json that uses mongodb as data/session store and redis for socket.io/pubsub.
{ "url": "myforum", "port": [4567, 4568], "database": "mongo", "mongo": { "host": "127.0.0.1", "port": "27017", "password": "", "database": "datastore" }, "session_store": { "name": "mongo", "host": "127.0.0.1", "port": "27017", "password": "", "database": "sessionstore" }, "redis": { "host": "127.0.0.1", "port": "6379", "password": "", "database": "0" } }
If you remove the
session_store
block from the above config. Redis will be preferred for the session store.session_store
block let's you explicitly define the database to use for sessions.If you are just running a single nodebb instance you can just have a single "mongo" or "postgress" block and it will be used for everything.
-
In the time since the topic of redis dependency for multiple processes last came up it seems socket.io created an official mongodb adapter: https://github.com/socketio/socket.io-mongo-adapter
(Docs: https://socket.io/docs/v4/mongo-adapter/) - though it works only on replica sets (due to the use of change streams)There is also a similarly recent Postgres adapter: https://github.com/socketio/socket.io-postgres-adapter (Docs: https://socket.io/docs/v4/postgres-adapter/)
So it should be now possible to remove the requirement for redis here.