Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Multiple instances and Multiple servers cluster in centos server

Open redgang opened this issue 9 years ago • 5 comments

Rocket.Chat Version: 0.53.0 Running Instances: 2 servers and Multiple instances DB Replicaset OpLog:N/A Node Version:4.7.1

image

I use nginx proxy two servers, each server through the 'meteorhacks: cluster' to open the Multiple instances,and mongodb done cluster processing.Now I use user1 to user2 send a message, but user2 can not receive the message in real time, user2 refresh the browser can receive the message. I want user2 to receive user1 made real-time news, how can i do.

redgang avatar Mar 27 '17 06:03 redgang

I do more server cluster deployment also encountered the same problem, do not know that there is no solution

xilu0 avatar Mar 27 '17 06:03 xilu0

In your db check the "instances" collection. Verify that for each instance "host" is your sever's IP address and not just "localhost". If you see "localhost", you need to set the environment variable process.env.INSTANCE_IP for each server with it's own IP address. Each instance uses process.env.INSTANCE_IP and process.env.PORT to broadcast events to other instances. The default value is "localhost" so each instance is only communicating with other instances on the same server.

You can see the usage of process.env.INSTANCE_IP here: https://github.com/RocketChat/Rocket.Chat/blob/0.54.2/server/startup/presence.js#L10 https://github.com/RocketChat/Rocket.Chat/blob/0.54.2/server/stream/streamBroadcast.js#L190

KirbySSmith avatar Mar 27 '17 13:03 KirbySSmith

@KirbySSmith Thank you for respond! I hadn't validated before fully, by looking at the source code to understand

export INSTANCE_IP=“ip”

xilu0 avatar Mar 27 '17 13:03 xilu0

@KirbySSmith Thank you for respond,I think the problem has been resolved!

redgang avatar Mar 28 '17 05:03 redgang

Can i setup 4 rocketchat instances on the same server and use single instance of Mongodb locally installed? also which file do i touch to address the below error Error: $MONGO_OPLOG_URL must be set to the 'local' database of a Mongo replica set Though i do not have replica, just a single instance

asifkh11 avatar Apr 19 '17 16:04 asifkh11