devmadhuu commented on code in PR #4540:
URL: https://github.com/apache/ozone/pull/4540#discussion_r1188405722
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java:
##########
@@ -350,6 +352,52 @@ public static InetSocketAddress getReconAddresses(
return NetUtils.createSocketAddr(hostname.get(), port);
}
+ /**
+ * Retrieve the socket addresses of Apache Solr Server.
+ *
+ * @return Apache Solr server address
+ * @throws IllegalArgumentException If the configuration is invalid
+ */
+ public static InetSocketAddress getSolrAddress(
+ ConfigurationSource conf) {
+ String solrAddresses = conf.get(OZONE_SOLR_ADDRESS_KEY);
+ LOG.info("Solr Live Host Addresses: {}", solrAddresses);
+ if (StringUtils.isEmpty(solrAddresses)) {
+ throw new IllegalArgumentException(String.format("For heatmap " +
+ "feature Solr host and port configuration must be provided " +
+ "for config key %s. Example format -> <Host>:<Port>",
+ OZONE_SOLR_ADDRESS_KEY));
+ }
+ String[] splitAddresses = solrAddresses.split(",");
+ if (solrAddresses.length() > 0) {
+ String name = splitAddresses[0];
+ if (StringUtils.isEmpty(name)) {
+ return null;
+ }
+ Optional<String> hostname = getHostName(name);
+ if (!hostname.isPresent()) {
+ throw new IllegalArgumentException("Invalid hostname for Solr Server: "
Review Comment:
> If multiple solr addresses are configured then we are considering only
first. If first address is not valid, can we try with next one? Or we need to
just consider first one?
Thanks @ashishkumar50 for review, we can do that, however these addresses
are recorded in Zookeeper hosted by Solr for its nodes and Solr has a mechanism
to ping these nodes and update Zookeeper accordingly, so if any node has any
problem, it will not be available in Zookeeper.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]