-2

After running db.getMongo().setSlaveOk(); still below error is coming while I am accessing collections from secondery node. As per my understanding I should able see its data from secondary node.

uncaught exception: error: { "$err" : "not master and slaveOk=false", "code" : 13435 }

I have used below command to create replica set

mkdir D:\data\repdb\One mkdir D:\data\repdb\The mkdir D:\data\repdb\Two mongod --port 27017 --dbpath D:\data\repdb\One --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27018 --dbpath D:\data\repdb\The --replSet rs0 --smallfiles --oplogSize 128 mongod --port 27019 --dbpath D:\data\repdb\Two --replSet rs0 --smallfiles --oplogSize 128 mongo --port 27017 rsconf = { "_id" : "rs0", "version" : 1, "members" : [ { "_id" : 1, "host" : "localhost:27017" } ] }

rs.initiate( rsconf )

rs.conf()

rs.add("localhost:27018") rs.add("localhost:27019")
Hidde
  • 11,493
  • 8
  • 43
  • 68
user3289889
  • 1
  • 1
  • 1
  • What exactly is the question? – Hidde Feb 09 '14 at 17:13
  • Yes .Its working now .Thanks Rishi fro your prompt answer. – user3289889 Feb 09 '14 at 18:22
  • Now I can see data on secondary using below :SECONDARY> db.book.find().count() Again I insert one row inside primary and its count reaches say 4 but its not reflecting then in secondary until re connect once again ..Why this ? – user3289889 Feb 09 '14 at 18:28

1 Answers1

1

Did you try: rs.slaveOk() on the Secondary member?

Rishi
  • 268
  • 1
  • 6