Spring Boot health check for Spring Data Solr - spring-boot

I'm now using Spring Boot, there's a health check problem.
I have multi-core using spring data solr, so the solr url is the base url, e.g. http://localhost:8983/solr, but the health check will call HttpSolrClient's ping method, which will return a 404 error, how can I do the health check for this situation.

I have the same problem with solr..
In Spring Boot version 1.5.9.RELEASE Solr health check works fine.
Now Healthcheck ping endpoint http://localhost:8983/solr/admin/cores so he check Solr serwer health instead at single core as it was before.
If is possible try update your spring boot version.

SolrPing solrPing = new SolrPing(); //infoCollection
SolrPingResponse solrPingResponse = solrPing.process(solrClient,infoCollection);
String status = (String) solrPingResponse.getResponse().get("status");

I Believe you can change the Management Port in application.properties which will divert your Management calls from hosted on 8983 port.

Related

Is eureka spring version independent?

For a project I am using Spring Eureka. It works great with Spring boot 1.5. I want to upgrade to Spring boot 2. I see that with Spring boot 2 the health endpoints have moved. Does eureka know how to handle this change?
Out of curiosity, when spring registers to eureka does it pass on what the health url is so that eureka knows where to contact the health url?
I did the spring boot version upgrade recently. Eureka works fine with spring boot 2.
Does eureka know how to handle this change?
Yes, based on below configuration it will look for the default /actuator/health endpoint.
/**
* Default prefix for actuator endpoints
*/
private String actuatorPrefix = "/actuator";
private String healthCheckUrlPath = actuatorPrefix + "/health";
So, if we have actuator endpoint enable it tries to connect to the given endpoint for health check.
when spring registers to eureka does it pass on what the health url is so that eureka knows where to contact the health url?
Yes, we can provide the health check URLs while registering client to eureka server. In that case it will always do the health check from provided endpoint.
Here goes the property we can use to set the same-
eureka.instance.health-check-url-path= HEALTH_CHECK_URL_PATH
OR,
eureka:
instance:
healthCheckUrlPath: HEALTH_CHECK_URL

Consul doesn't show Health

I couldn't check health of my services after the new spring boot upgrade from 1.5x to 2.x. I tried to call /health endpoint which throws an error, then view some spring boot article which said I need to call /actuator/health, then it shows
{"status":"UP"}
I have added this property "management.endpoint.health.show-details=ALWAYS" then it shows something like this.
{"status":"UNKNOWN","details":{"binders":{"status":"UNKNOWN","details":{"consul":{"status":"UNKNOWN"}}},"diskSpace":{"status":"UP","details":{"total":254447448064,"free":149837242368,"threshold":10485760}},"db":{"status":"UP","details":"database":"Oracle","hello":"Hello"}},"refreshScope":{"status":"UP"},"discoveryComposite":{"status":"UNKNOWN","details":{"discoveryClient":{"status":"UP","details":{"services":[]}}}},"clientConfigServer":{"status":"UP","details":{"propertySources":[]}},"hystrix":{"status":"UP"}}}
Can some one let me know, what properties need to be added to see the status instead of "UNKNOWN". Thanks in advance.

Metrics of redis and solr in spring boot

I have services built in spring boot 2.0.2. I`m using redis and solrj.
Now if i want to get metrics of redis and solr. It don`t show in
http://localhost:8080/actuator/metrics
Is there any way e.g making custom endpoint to get redis and solr metrics?
Any help would be appreciated..
Yes, it should be possible.
Spring boot 2's default metrics framework is Micrometer
When this framework is integrated into spring boot application (via starter as usual), any metrics reported to micrometer will immediately appear in spring boot actuator.
So the question is whether the redis/solrj integration expose Metrics or not.
If they are not, you'll have to understand what exactly you want to measure and plug in the integration.
Here is the example:
import io.micrometer.core.annotation;
#Timed("my-redis-calls")
public void doSomethingInMyCode() {
//call redis here
}
Of course, there is also a programmatic interface, using annotations in not mandatory
The code shown in Mark Bramnik's answer doesn't specifically give you timing for Redis client calls, it gives you timing for doSomethingInMyCode method, which can be different.
Micrometer support seems to be available in the Lettuce 6.1 release.
MeterRegistry meterRegistry = …;
MicrometerOptions options = MicrometerOptions.create();
ClientResources resources = ClientResources.builder().commandLatencyRecorder(new MicrometerCommandLatencyRecorder(meterRegistry, options)).build();
RedisClient client = RedisClient.create(resources);
https://lettuce.io/core/release/reference/index.html#command.latency.metrics.micrometer

Will apache Ignite identify the current host and port of webservice it is used in by itself?

What kind of configuration should be used to make the apache ignite used in a restful webservice to identify itself the host and port wherever it is deployed.
I could see directly giving host and port name in the example-ignite.xml file.
Ignite doesn't know whether it's in web service or not. You need to configure your own web service, for example, using jetty + jersey and call Ignite API from it when it's needed:
Ignite Spring Boot integration example, Spring Boot REST service example
Ignite also comes with it's own REST API:
https://apacheignite.readme.io/docs/rest-api

Spring Boot Server using HTTPS, Management Server only HTTP?

Based on an answer from #andy-wilkinson to a past Spring Boot question, it appears that with the exception of a couple parameters (port for example), the management server leverages the same configuration as the regular servlet container.
I would like to configure the main Spring Boot server to use HTTPS (for the application/service it is serving) and to use just HTTP for the actuator endpoints. Has anyone done this? Is this even possible?
-Joshua
It's not possible at the moment. Please open an issue if it's an enhancement that you'd like to see.

Resources