On Wednesday, April 10, 2013 8:21:51 PM UTC-7, Asya Kamsky wrote:
Wade,The problem with commenting on extremely old threads is that you might miss that the shell now has ability to connect to a replica set (and reconnect to primary automatically).Just use'mongo -host replSetName/host:port' where you would use your replica set name and give one of the hosts that's currently up - the shell will figure out the rest.Asya
On Wednesday, January 9, 2013 8:54:16 AM UTC-8, Wade Kaple wrote:I was having a similar issue, but in the context of automated deployments. In order to not have to double check for the primary, I created a findMaster.js file that I pass into the shell before the script that I am trying to execute. Contents of the file (check if this is primary, otherwise connect to primary):var master = db.isMaster();if (master.ismaster == false){db = connect(master.primary + '/' + db);}Then just call the shell with this file first:mongo <address>/<db> findMaster.js <scriptToExec>.jsThe reassignment of the db variable is then available to the second script.
댓글 없음:
댓글 쓰기