Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encountered a MongoDB warning after converting a replica set to stand alone server

I encountered the following warning after converting a mongodb replica set to a stand alone server. I did rs.remove('host') and removed the replSet arguments when starting the mongo db.

[root@sam ~]# mongo
MongoDB shell version: 2.4.3
connecting to: test
Server has startup warnings: 
Tue Jul  9 17:18:46.076 [initandlisten] 
Tue Jul  9 17:18:46.076 [initandlisten] ** WARNING: mongod started without --replSet yet 1 documents are present in local.system.replset
Tue Jul  9 17:18:46.077 [initandlisten] **          Restart with --replSet unless you are doing maintenance and no other clients are connected.
Tue Jul  9 17:18:46.077 [initandlisten] **          The TTL collection monitor will not start because of this.
Tue Jul  9 17:18:46.077 [initandlisten] **          For more info see http://dochub.mongodb.org/core/ttlcollections
Tue Jul  9 17:18:46.077 [initandlisten] 
> 

Please help. Need to fixed it immediately. Thanks.

like image 382
Sam Avatar asked Jul 09 '13 09:07

Sam


People also ask

What is the purpose of using replica set in MongoDB?

A replica set in MongoDB is a group of mongod processes that maintain the same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments. This section introduces replication in MongoDB as well as the components and architecture of replica sets.

How does replica set connect to MongoDB?

To connect to a replica set deployment, specify the hostname and port numbers of each instance, separated by commas, and the replica set name as the value of the replicaSet parameter in the connection string. In the following example, the hostnames are host1 , host2 , and host3 , and the port numbers are all 27017 .


2 Answers

The local database contains replica set information among other things. You can drop the local database without ill effect.
Use the following comments to drop the local database.

use local
db.dropDatabase()

The warning messages should go away after restarting mongod

like image 196
Sherry Ger Avatar answered Sep 22 '22 12:09

Sherry Ger


use local;
db.dropDatabase();
db.system.replset.remove ({});

Quit the mongo shell .. restart service just in case "service mongod restart"

mongo --host bind_ip --port bind_port
like image 30
Hugo Flambó Avatar answered Sep 20 '22 12:09

Hugo Flambó