Very weird behaviour when hosting multiple instances
-
Your configs look good, when you get a chat notification on the other instances do you actually get the chat message? If you reload the page and open up your chats do you see chat messages from users on other forums? If not then this might be isolated to socket io and the redis store we use to pub/sub socket messages across worker processes.
-
Yes, the chat messages are actually delivered on other instances. After reload, the chat messages are not displayed any more.
This is @Master-Antonio 's forum with a chat between him and me. He has UID #1 and I got #3.
This is my forum where I got UID #1 and it seems as I'm chatting with myself.
-
@Netto-Hikari
Yes, i confirm.
This is big Problem.
And i confirm if reload the page message not appears. -
From redis docs
Database & Scoping Pub/Sub has no relation to the key space. It was made to not interfere with it on any level, including database numbers. Publishing on db 10, will be heard on by a subscriber on db 1. If you need scoping of some kind, prefix the channels with the name of the environment (test, staging, production, ...).
So at this point nodebb wont work with 3 instances using the same redis instance on different databases.
You can however have 3 redis instances on different ports ie (6379, 6380, 6381 so on) and use db 0 for all of them.
-
@baris Okay, then I'll do that. Is there a way to easily dump and restore a single database from a redis instance?
-
@baris Thank you so much for your help. I'm running 3 instances of redis now and it seems to be working.