question: private boolean isRunningInsideDataCenter ( ) { Set < String > hosts = zkClusterData . getSolrHosts ( ) ; String solrPingQueryTemplate = "http://%s:%s/solr/collection1/select?q=*:*" ; for ( String host : hosts ) { String solrQuery = String . format ( solrPingQueryTemplate , host , SolrInteractionUtils . DEFAULT_SOLR_PORT ) ; try { SolrInteractionUtils . executeSolrCommandWithTimeout ( SolrInteractionUtils . CONNECT_TIMEOUT , solrQuery ) ; logger . info ( "Succesfully connected to host " + host + ". We can use Internal Ips.." ) ; return true ; } catch ( IOException e ) { logger . info ( "Encountered Exception while trying to connect to " + host ) ; return false ; } } logger . info ( "Connecting to all the hosts with Internal Ips failed. Running in local mode.." ) ; return false ; }
target:  Given a setup of solr hosts, it tries to query solr running on them using the private ip. If they return a valid response, we are running inside ec2 realm else we need to run in local mode.