It looks like you need to use the CloudSolrClient to instantiate the SolrClient bean
https://dzone.com/articles/spring-data-solr-cloud-zookeeper-mongodb-ubuntu-in
@Configuration
@EnableSolrRepositories(basePackages = { "ca.knc.restaurant.repository.solr" }, multicoreSupport = true)
public class SpringSolrConfig {
@Value("${spring.data.solr.zk-host}")
private String zkHost;
@Bean
public SolrClient solrClient() {
return new CloudSolrClient(zkHost);
}
@Bean
public SolrTemplate solrTemplate(SolrClient solrClient) throws Exception {
return new SolrTemplate(solrClient);
}
}
You can also set it through the application.properties and let Spring Boot autoconfigure it :
spring.data.solr.zk-host= # ZooKeeper host address in the form
HOST:PORT.
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.java
Otherwise, you can use a LoadBalancer to serve your Solr Instances and use a regular Solr Host configuration
For example, I have the following configuration (yml config) :
spring.data.solr.host: https://foo.bar.com/solr
Where foo.bar.com serves one of my Solr instance with Apache as a standard Load Balancer.