Hi Sudheer These are I believe implementation specific modifications.
Could you continue this correspondence with Gareth, ccd, who leads our implementation work at Deutsche? Thanks Ken Tune From: [email protected] [mailto:[email protected]] On Behalf Of Sudheer Yalaverthi Sent: 11 March 2016 19:22 To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] Regarding ROXY custom extension http calls Hi, We have some custom ROXY extensions to support cluster management activities like replicate databases and remove database replications. I have these below two methods to support replication removal and this works fine when both the clusters are available. def remove_database_replication(database = @properties["ml.content-db"]) get_admin_password get_dr_admin_password begin params = {:database_name => database} url = %Q{http://#{@properties["ml.dr-host"]}:#{@properties["ml.app-port"]}/admin/delete-database-master.xqy} url = url_with_parameters(url,params) logger.info "Removing replication for #{database} from #{@properties["ml.server"]}<mailto:#{@properties["ml.server"]}> to #{@properties["ml.dr-host"]}<mailto:#{@properties["ml.dr-host"]}> - replica side " go url,'get',{},nil,nil,false,@properties["ml.dr-admin-user"],@properties["ml.dr-admin-password"] rescue => error logger.info "#{error.class} and #{error.message}" logger.info "An error occurred when trying to remove database replication for database #{database} from replica side. Investigate the logs and admin screens. You may have to perform this step manually. If you are in a DR situation this may relate to host unavailability" end sleep 30 begin params = {:database_name => database} url = %Q{http://#{@properties["ml.server"]}:#{@properties["ml.app-port"]}/admin/delete-database-replication.xqy} url = url_with_parameters(url,params) logger.info "Removing replication for #{database} from #{@properties["ml.server"]}<mailto:#{@properties["ml.server"]}> to #{@properties["ml.dr-host"]}<mailto:#{@properties["ml.dr-host"]}> - master side" r = go(url,'get',{},nil,nil,false,@properties["ml.user"],@properties["ml.password"]) rescue RuntimeError logger.info "An error occurred when trying to remove database replication for database #{database} from master side. Investigate the logs and admin screens. You may have to perform this step manually. If you are in a DR situation this may relate to host unavailability" end end def remove_database_replications dbnames = @properties["ml.replicate-dbs"].split(",") #Need to replicate the content database remove_database_replication @properties["ml.content-db"] #Need to replicate all other databases that are configured in properties file (dbnames).each do |dbname| remove_database_replication dbname end end But I when shutdown the primary and try to execute these, I expect that DR side invocation will be successful and Primary side call fails as it is not reachable. That seems to work fine for 1st database and for the subsequent databases, the http call is not at all happening though I see a log message before the go method invocation. Enter password for admin on primaryhostname : (Production) Enter password for admin on drhostname : (DR) Removing replication for engineering-lab-content from primaryhostname to drhostname - replica side Request made to http://drhostname:8041 using user_name admin Removing replication for engineering-lab-content from primaryhostname to drhostname - master side Request made to http://primaryhostname:8041 using user_name admin Roxy::Http : request failure count: 1, exception: #<Errno::ECONNREFUSED: Connection refused - connect(2)> Roxy::Http : request failure count: 2, exception: #<Errno::ECONNREFUSED: Connection refused - connect(2)> Roxy::Http : request failure count: 3, exception: #<Errno::ECONNREFUSED: Connection refused - connect(2)> Roxy::Http : request failure count: 4, exception: #<Errno::ECONNREFUSED: Connection refused - connect(2)> Roxy::Http : re-raising same error: primaryhostname temporarily unavailable: (Connection refused - connect(2)) -- error count: 4, error age: 0 An error occurred when trying to remove database replication for database engineering-lab-content from master side. Investigate the logs and admin screens. You may have to perform this step manually. If you are in a DR situation this may relate to host unavailability Removing replication for Security from primaryhostname to drhostname - replica side Request made to http://drhostname:8041 using user_name admin Roxy::Http : re-raising same error: primaryhostname temporarily unavailable: (Connection refused - connect(2)) -- error count: 4, error age: 0 RuntimeError and primaryhostname temporarily unavailable: (Connection refused - connect(2)) An error occurred when trying to remove database replication for database Security from replica side. Investigate the logs and admin screens. You may have to perform this step manually. If you are in a DR situation this may relate to host unavailability Removing replication for Security from primaryhostname to drhostname - master side Request made to http://primaryhostname:8041 using user_name admin Roxy::Http : request failure count: 5, exception: #<Errno::ECONNREFUSED: Connection refused - connect(2)> Roxy::Http : re-raising same error: primaryhostname temporarily unavailable: (Connection refused - connect(2)) -- error count: 5, error age: 0 An error occurred when trying to remove database replication for database Security from master side. Investigate the logs and admin screens. You may have to perform this step manually. If you are in a DR situation this may relate to host unavailability Removing replication for Triggers from primaryhostname to drhostname - replica side Request made to http://drhostname:8041 using user_name admin Roxy::Http : re-raising same error: primaryhostname temporarily unavailable: (Connection refused - connect(2)) -- error count: 5, error age: 0 RuntimeError and primaryhostname temporarily unavailable: (Connection refused - connect(2)) An error occurred when trying to remove database replication for database Triggers from replica side. Investigate the logs and admin screens. You may have to perform this step manually. If you are in a DR situation this may relate to host unavailability Removing replication for Triggers from primaryhostname to drhostname - master side Request made to http://primaryhostname:8041 using user_name admin Roxy::Http : request failure count: 6, exception: #<Errno::ECONNREFUSED: Connection refused - connect(2)> Roxy::Http : re-raising same error: primaryhostname temporarily unavailable: (Connection refused - connect(2)) -- error count: 6, error age: 0 An error occurred when trying to remove database replication for database Triggers from master side. Investigate the logs and admin screens. You may have to perform this step manually. If you are in a DR situation this may relate to host unavailability Green color highlights first call for content database on the replica side that is successful. Yellow color highlights the call that are expected to be successful for DR but never seen reaching the DR MarkLogic server side and ROXY just spits the old error message of connection error for master host. I am new to ruby and appreciate your help in solving this. I have looked into RoxyHttp.rb file request method a little and It looks like it is coded that way. I would like to get around this and treat new requests differently. Thanks. Regards, Sudheer Yalaverthi NoSQL Engineer --- This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender immediately and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Deutsche Bank does not render legal or tax advice, and the information contained in this communication should not be regarded as such.
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
