How to register Solr with Eureka

I have 2 Spring applications ("client application" and "service application") that are already registered with Eureka (and speak through Feign Client). However, I have to talk to the Solr instance, and I am forced to hard-code the IP address in the properties file. I would rather not do this and use Eureka to discover services.

Question : Is there a way / plugin for solr to register itself with Eureka so that clients can detect it (even if it is programmatically through a start listener or some kind of one)?

I looked at the solr API and does not seem to have a lifecycle listener (onStartUp or onShutdown hooks)

+5
source share
1 answer

To do this, you will need Solr Plugin , which SolrCore knows . This inform interface method is called at any time when something interesting happens to the kernel. As part of the implementation of the information method, you need to register / unregister as a client.

Then you need to add it to your Solr (Cloud) instance . After that and properly setting up your plugin, it should work.

+2
source

Source: https://habr.com/ru/post/1262885/


All Articles