Mongo scripts connect to Replica-set

Source: Internet
Author: User

Now you can directly connect to replica-set and log on to primary.

For example:

Mongo -- host rs1/vm1: 27017, vm3: 27017, vm4: 27017 db_name, and a bunch of information is displayed.

Thu Dec 12 16:44:48. 227 successfully connected to seed vm1: 27017 for replica set rs1 Thu Dec 12 16:44:48. 228 changing hosts to {0: "vm1: 27017", 1: "vm4: 27017", 2: "vm3: 27017"} from rs1/Thu Dec 12 16:44:48. 228 trying to add new host vm1: 27017 to replica set rs1 Thu Dec 12 16:44:48. 229 successfully connected to new host vm1: 27017 in replica set rs1 Thu Dec 12 16:44:48. 229 trying to add new host vm3: 27017 to replica set rs1 Thu Dec 12 16:44:48. 232 successfully connected to new host vm3: 27017 in replica set rs1 Thu Dec 12 16:44:48. 232 trying to add new host vm4: 27017 to replica set rs1 Thu Dec 12 16:44:48. 234 successfully connected to new host vm4: 27017 in replica set rs1 Thu Dec 12 16:44:48. 240 Primary for replica set rs1 changed to vm1: 27017 Thu Dec 12 16:44:48. 247 replica set monitor for replica set rs1 started, address is rs1/vm1: 27017, vm3: 27017, vm4: 27017 Thu Dec 12 16:44:48. 247 [ReplicaSetMonitorWatcher] starting

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.