程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> DB2數據庫 >> DB2教程 >> Mongo腳本連接Replica-set

Mongo腳本連接Replica-set

編輯:DB2教程

現在已經支持直接自動連接到replica-set,並登錄primary

比如:

mongo --host rs1/vm1:27017,vm3:27017,vm4:27017 db_name然後會看到一堆信息

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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved