Mongodb cluster problem.

  mongodb, question

At the beginning of contact with mongodb, I installed mongodb in two local virtual machines respectively.

Now the cluster is successful, the master can add, delete, change and check it for receipt.

However, the problem is that the data count in the backup is correct, but the query cannot be found. how can it be solved?

There is another problem. In nodejs, point to a mongodb server, then this server is dead.

The cluster will switch to another server, so how does the program know which server I should use?

Then I just found another problem. I added a database on the main computermytestAlso createdcollectionData added

However, it is not synchronized to the backup. Is it necessary to set the specified library?

  1. Use rs.slaveOk ()
  2. It seems that only the program can judge.
  3. Because the content of your test results in out-of-sync, just remove and add it again.