How to connect Java with MongoDB in Windows Azure's worker role? -
i have spring restful web service project use "spring data mongodb" library connect mongodb database.
after testing local machine, ready deploy on cloud server (windows azure's worker role).
i have followed step-by-step official website (here) additional worker role called tomcatworkerrole (since want run mongodb internal use only, have deploy web application in same cloud service).
everything works fine in deployment in setting database connection of application not that.
the problem because replica-set ..
rs:primary> rs.conf() { "_id" : "rs", "version" : 1, "members" : [ { "_id" : 0, "host" : "rs_0:27017" }, { "_id" : 1, "host" : "rs_1:27017" }, { "_id" : 2, "host" : "rs_2:27017" } ] } due description ..
to account possible changes in ips of instances running mongodb, worker role uses hosts file alias each of instances. hence client application instance needs same instances. additionally client application must have name of replica set.
the problem how can know "rs_x" stand host ? because have specify host in order create client connection.
could me, please ? have change mind use vm's role mongodb instead of worker role ?
thank you.
ps. sorry english.
Comments
Post a Comment