RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.4k stars 10.51k forks source link

Replicaset cant start with number #12781

Open geekgonecrazy opened 5 years ago

geekgonecrazy commented 5 years ago

Rocket.Chat 0.72.0 uses Meteor 1.8 which introduces the issue.

MongoError: no primary found in replicaset or invalid replica set name

Example of connection string:

MONGO_URL=mongodb://127.0.0.1:27017/rocketchat?replicaSet=001-rs

More details here: https://github.com/meteor/meteor/issues/10362

tars21 commented 5 years ago

same here after updating from 0.71.1 to 0.72

Description:

After updating from 0.71.1 to 0.72 Rocket.Chat does not start anymore

Server Setup Information:

Relevant logs:

systemd[1]: Started Rocket.Chat Server running at port 3001.
RocketChat[20060]: /srv/rocketchat-program/rocket.chat-0.72.0/programs/server/node_modules/fibers/future.js:313
RocketChat[20060]:                                                 throw(ex);
RocketChat[20060]:                                                 ^
RocketChat[20060]: MongoError: no primary found in replicaset or invalid replica set name
RocketChat[20060]:     at /srv/rocketchat-program/rocket.chat-0.72.0/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/replset.js:636:11
RocketChat[20060]:     at Server.<anonymous> (/srv/rocketchat-program/rocket.chat-0.72.0/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/replset.js:357:9)
RocketChat[20060]:     at Object.onceWrapper (events.js:315:30)
RocketChat[20060]:     at emitOne (events.js:116:13)
RocketChat[20060]:     at Server.emit (events.js:211:7)
geekgonecrazy commented 5 years ago

Unfortunately I’m not sure of a work around :(. Safest bet is to stay on 0.71.1 and wait until meteor fixes and we in turn can release a patch :(

TomaszDom commented 5 years ago

Guys, your own documentation suggests using a number for the replicaset name https://rocket.chat/docs/installation/manual-installation/mongo-replicas/

We would all appreciate a word of warning somewhere on the release page, every time I plan on upgrading our instance I have to trawl through dozens of reports to find a potential blocker like this one, not cool.

geekgonecrazy commented 5 years ago

@TomaszDom We've updated the documentation to use the replicaset we normally recommend using. Also have added to release notes. Hopefully the upstream release happens soon so we can release a fix. Thanks for your patience!

Venomen commented 5 years ago

Is this repaired in 0.72.1 allready?

geekgonecrazy commented 5 years ago

It is not. Apparently we are the only meteor project that had users create starting with a number. As soon as they do we'll try to cut a release. At the very least hopefully its fixed by 0.73.0

@rodrigok @sampaiodiego do either of you know if we can update the mongo library in just our project? Or would that have too many unknown consequences?

rodrigok commented 5 years ago

@geekgonecrazy that is a good question. I asked the meteor developer again, lets see.

TomaszDom commented 5 years ago

Looking at how meteor development cycles go, I think we have a few months without upgrades to go.

geekgonecrazy commented 5 years ago

For any of those here experiencing it feel free to thumbs up the meteor issue. Maybe we can make a bit of noise and get it to happen a bit quicker.

TomaszDom commented 5 years ago

@geekgonecrazy would you consider the suggestion by @sebakerckhof in that report?

geekgonecrazy commented 5 years ago

As I mentioned above the concern is it may have unknown consequences. The mongo driver and the meteor collections and other things are pretty directly related. Definitely not something we would want to jump to.

vcmor commented 5 years ago

Is it possible to rename RC's replicaset name 001-rs safely?

geekgonecrazy commented 5 years ago

https://stackoverflow.com/a/33400608 this might be of use. Note I have not tried... I would make sure to backup before doing it in any case.

If its a single node mongo cluster... it might be easier to do a backup. Wipe the mongo db re-initialize with new replicaset name... and then re-import your data.

TomaszDom commented 5 years ago

FWIW, I decided to change the replicaset name according to that solution and it worked fine, then upgraded from 0.69.x to 0.73.2 without issues.

tars21 commented 5 years ago

Just fyi: The ReplicaSet renaming worked for me, too.

LeandroSalvas commented 4 years ago

I'm using 1.1.1 and the problem still happens. One option to temporarily solve this problem is change the replica set name before update your version.

cmol commented 4 years ago

I had this issue in a docker container setup, with one mongodb container and one rocketchat.

It was the name of the replication set member that was not getting updated (it was set to the name of the container when mongodb was created). Changing it to the name of the current container fixed the issue, but this needs to be done any time you update the container which seems like a bad idea. Don't know what the best solution here would be, as it's not really a rocketchat problem but a mongodb problem?

cfg = rs.conf()
cfg.members[0]["host"] = "[insert_correct_hostname_or_ip]:27017"
rs.reconfig(cfg)

If your mongodb instance does not say "PRIMARY" when logging into it, you might need to run the last command as: rs.reconfig(cfg, {force: true})

And of course back up your data before trying this out.

nickersk commented 4 years ago

try to run sudo mongo --eval 'rs.initiate();'