title: mongodb, replicates and error: { "$err" : "not master and slaveOk=false", "code" : 13435 }
body: <p>I tried mongo replica sets for the first time.</p>
  
  <p>I am using ubuntu on ec2 and I booted up three instances.
  I used the private IP address of each of the instances.  I picked on as the primary and below is the code.</p>
  
  <pre><code>mongo --host Private IP Address
  rs.initiate()
  rs.add(“Private IP Address”)
  rs.addArb(“Private IP Address”)
  </code></pre>
  
  <p>All at this point is fine.  When I go to the <a href="http://ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com:28017/_replSet">http://ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com:28017/_replSet</a> site I see that I have a primary, seconday, and arbitor.</p>
  
  <p>Ok, now for a test.  </p>
  
  <p>On the primary create a database in this is the code:</p>
  
  <pre><code>use tt
  db.tt.save( { a : 123 } )
  </code></pre>
  
  <p>on the secondary, I then do this and get the below error:</p>
  
  <pre><code>db.tt.find()
  error: { "$err" : "not master and slaveOk=false", "code" : 13435 }
  </code></pre>
  
  <p>I am very new to mongodb and replicates but I thought that if I do something in one, it goes to the other.  So, if I add a record in one, what do I have to do to replicate across machines?</p>