I had my first server on a Dreamhost Dedicated Server.
Now I've moved it to Google Cloud.
How many users are you going to support?
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.
Yes, i confirm.
This is big Problem.
And i confirm if reload the page message not appears.
So the messages are not actually saved into the wrong database, its just socket io seems to deliver it to all the instances running on the same redis instance even though they use different database ids.
@baris That's correct.
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?
I think you will have to get a copy of your *.rdb file and copy it to all redis instances. I don't know a quick way of moving db 1 to db 0 etc.
Also looks like this might be a non issue when we upgrade to socket io 1.0+ and use the redis-adapter seems like it supports prefixes https://github.com/Automattic/socket.io-redis/blob/master/index.js#L48
@baris Thank you so much for your help. I'm running 3 instances of redis now and it seems to be working.