Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot upgrade sharded mongoDB or stop the balancer

mongos is not running in the beginning. When tried to start the mongos I see the following log:

Fri Mar 22 17:43:13.383 [mongosMain] ERROR: error upgrading config database to v4 :: caused by :: newer version 4 of mongo config metadata is required, current version is 3, need to run mongos with --upgrade

But with --upgrade parameter, I see the following log:

Fri Mar 22 17:43:39.273 [mongosMain] ERROR: error upgrading config database to v4 :: caused by :: balancer must be stopped for config upgrade

Now the problem is: I cannot stop the balancer by sh.stopBalancer() because I cannot start mongos. It's a deadlock to me now. Please help.

like image 876
shuaiyuancn Avatar asked Jan 14 '23 21:01

shuaiyuancn


1 Answers

I found the the problem. I should connect to port 27019 for a configsrv. In this way I don't need to start mongos. Instead the sh.stopBalancer() could be executed simply in mongo interpreter.

like image 51
shuaiyuancn Avatar answered Jan 22 '23 14:01

shuaiyuancn