mongodb - Couldn't connect to new shard ReplicaSetMonitor no master found for set -


i'm trying deploy sharded cluster in mongodb

i followed tutorial here

http://docs.mongodb.org/manual/tutorial/convert-replica-set-to-replicated-shard-cluster/

first deployed replica set test data on separate machine ip 192.168.1.212

and status after finished deploying it

firstset:primary> rs.status(); {     "set" : "firstset",     "date" : isodate("2014-03-24t10:54:06z"),     "mystate" : 1,     "members" : [         {             "_id" : 1,             "name" : "localhost:10001",             "health" : 1,             "state" : 1,             "statestr" : "primary",             "uptime" : 117,             "optime" : timestamp(1395650164, 10507),             "optimedate" : isodate("2014-03-24t08:36:04z"),             "self" : true         },         {             "_id" : 2,             "name" : "localhost:10002",             "health" : 1,             "state" : 2,             "statestr" : "secondary",             "uptime" : 65,             "optime" : timestamp(1395650164, 10507),             "optimedate" : isodate("2014-03-24t08:36:04z"),             "lastheartbeat" : isodate("2014-03-24t10:54:05z"),             "lastheartbeatrecv" : isodate("2014-03-24t10:54:05z"),             "pingms" : 0,             "lastheartbeatmessage" : "syncing to: localhost:10001",             "syncingto" : "localhost:10001"         },         {             "_id" : 3,             "name" : "localhost:10003",             "health" : 1,             "state" : 2,             "statestr" : "secondary",             "uptime" : 51,             "optime" : timestamp(1395650164, 10507),             "optimedate" : isodate("2014-03-24t08:36:04z"),             "lastheartbeat" : isodate("2014-03-24t10:54:05z"),             "lastheartbeatrecv" : isodate("2014-03-24t10:54:04z"),             "pingms" : 0,             "lastheartbeatmessage" : "syncing to: localhost:10001",             "syncingto" : "localhost:10001"         }     ],     "ok" : 1 } 

then deployed 3 config server on separate machine run mongos instance on machine

then wanted add replica shard using following command

sh.addshard("firstset/192.168.1.212:10001,192.168.1.212:10002,192.168.1.212:10003") 

but following error

mongos> sh.addshard('firstset/192.168.1.212:10001,192.168.1.212:10002,192.168.1.212:10003'); {     "ok" : 0,     "errmsg" : "couldn't connect new shard replicasetmonitor no master found set: firstset" } 

i found solution problem sammaye's help

the problem when replica set initiated should take care of ips use because when router try connect replica set, reads configuration file if use rs.initiate() setting configuration, configuration

{     "_id" : "firstset",     "version" : 1,     "members" : [         {             "_id" : 1,             "host" : "localhost:10001"         },         {             "_id" : 2,             "host" : "localhost:10002"         },         {             "_id" : 3,             "host" : "localhost:10003"         }     ] } 

so router try search @ localhost find primary replica set won't find because on other machine

if use different machines testing initialize replica set manually following

rsconf ={     "_id" : "firstset",     "version" : 1,     "members" : [         {             "_id" : 1,             "host" : "machine_ip:machine_port"         },         {             "_id" : 2,             "host" : "machine_ip:machine_port"         },         {             "_id" : 3,             "host" : "machine_ip:machine_port"         }     ] } rs.initiate(rsconf); 

also if use either “localhost” or “127.0.0.1” host identifier, must use “localhost” or “127.0.0.1” host settings mongodb instances in cluster. applies both host argument addshard , value mongos --configdb run time option. if mix localhost addresses remote host address, mongodb produce errors.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -