问题
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.
回答1:
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.
回答2:
I had the same problem just now. I updated my mongo database from verion 2.0.4 to 2.4.3. I cannot connect to mongos because config server need to be upgraded. However, I can not stop the balancer using command stopBalancer() because my mongos is inactive. I did not find other solutions from stackoverflow. I tried many times.
My solution is: 1, ssh to the config server;
2, use config database;
maybe need to pass authentication;
3, run db.settings.update( { _id: "balancer" }, { $set : { stopped: true } } , true ) to stop balancer;
4, I can run "mongos" with --upgrade option;
回答3:
Assuming you followed the recommendation to always run 3 config server, I would try these steps:
Make sure all other mongos clients are stopped. If no mongos are running, no balancer should be keeping a lock either.
If you still get the error (after being certain that no mongos are connected to the config servers) I would stop all config servers but one and clear any remains of balancer locks in the admin database. After a successful try with this config server, I would reset the other two. If it was not successful, you still have two other copies.
回答4:
I had the same problem. The solution for me was to connect to the configsvr with mongo shell
mongo --host ip_of_config_server_host --port 27019
and setting the balancer off from there with
sh.setBalancerState(false)
After this I could do the config server upgrade with
mongos --port 27017 --configdb ip_of_config_server_host --upgrade
来源:https://stackoverflow.com/questions/15576766/cannot-upgrade-sharded-mongodb-or-stop-the-balancer