-
1. Re: hotrod client properties in application-{profile}.properties (spring boot)
sebastian.laskawiec Jun 12, 2017 9:05 AM (in response to sea_shankar)The short answer is no. This works only for `application.properties` as far as I know.
The good news is that the latest version (1.0.0.Final) supports reading all properties from both `hotrod-client.properties` as well as `application.properties`. You might find relevant information in documentation and/or tests files.
-
2. Re: hotrod client properties in application-{profile}.properties (spring boot)
sea_shankar Jun 12, 2017 4:46 PM (in response to sebastian.laskawiec)I put the following in hotrod-client.properties (my hotrod is actually listening on 174.20.0.2:11222)
infinispan.client.hotrod.server_list=173.20.0.2:11222;173.20.0.2:11372
But for some reason it keeps connecting to 174.20.0.2:11222. Is this intended behaviour? It's connecting to the right one, but how does it do that when I have a different list in the properties file?
-
3. Re: hotrod client properties in application-{profile}.properties (spring boot)
sebastian.laskawiec Jun 13, 2017 8:26 AM (in response to sea_shankar)The Hot Rod client pulls a list of Infinispan server from the cluster. Later on it uses this list together with consistent hash to optimize request routing. We call it hash-distribution-aware client.
So if 174.20.0.2 is part of your cluster than that's a correct behavior. Otherwise it's a configuration error (you could probably set a debugger breakpoint here and see what is happening and why).
-
4. Re: hotrod client properties in application-{profile}.properties (spring boot)
sea_shankar Jun 13, 2017 8:35 AM (in response to sebastian.laskawiec)Thanks for the quick response. I was just curious how it found the correct one and I thought the hotrod client properties would be the one it always looks at. Just curious, when would you put a server list if it already pulls the list from the cluster?
-
5. Re: hotrod client properties in application-{profile}.properties (spring boot)
sebastian.laskawiec Jun 13, 2017 8:41 AM (in response to sea_shankar)The server list always needs to be there. It is required for doing the initial connection and pulling the list of other cluster members.
-
6. Re: hotrod client properties in application-{profile}.properties (spring boot)
sea_shankar Jun 13, 2017 8:47 AM (in response to sebastian.laskawiec)Got it. Also, if I have say 3 servers in a cluster, in my server list, if I just put one of the servers should be sufficient?
-
7. Re: hotrod client properties in application-{profile}.properties (spring boot)
sebastian.laskawiec Jun 13, 2017 8:55 AM (in response to sea_shankar)Yes, that should work. But I wouldn't recommend it. What if this one particular server is down?
I would recommend to either put all servers on the list or create a a load balancer/virtual IP with all servers behind it. Then you could use that IP address.
-
8. Re: hotrod client properties in application-{profile}.properties (spring boot)
sea_shankar Jun 13, 2017 9:10 AM (in response to sebastian.laskawiec)Awesome, thanks a lot for your help and quick responses Sebastian!
-
9. Re: hotrod client properties in application-{profile}.properties (spring boot)
sea_shankar Jun 13, 2017 9:16 AM (in response to sebastian.laskawiec)Oh btw, if I wanted to do environment specific server list, currently since only hotrod-client.properties and application.properties has the list, I guess the only way is to do a CongiruationBuilder and pass the hosts and ports set in the environment specific properties file?
-
10. Re: hotrod client properties in application-{profile}.properties (spring boot)
sebastian.laskawiec Jun 13, 2017 9:31 AM (in response to sea_shankar)I think the best way in that case would be to use InfinispanRemoteConfigurer (in the future release you will be able to use Configuration beans but this part has not been released yet).
A pseudo-code of a Spring configuration could look like the following:
@Configuration
public class InfinispanConfiguration {
@Value("${serverFromEnvironment}")
private String server;
@Bean
public InfinispanRemoteConfigurer infinispanRemoteConfigurer() {
return () -> new ConfigurationBuilder()
.addServer()
.host(server)
.port(11222)
.build();
}
}
After adding InfinispanConfiguration you can remove the server list from application.properties (the configurer overrides all other settings; it has the highest priority).
-
11. Re: hotrod client properties in application-{profile}.properties (spring boot)
sea_shankar Jun 13, 2017 9:37 AM (in response to sebastian.laskawiec)And this needs to be added to RemoteCacheManger: new RemoteCacheManager( infinispanRemoteConfigurer() )?
-
13. Re: hotrod client properties in application-{profile}.properties (spring boot)
sea_shankar Jun 13, 2017 10:09 AM (in response to sebastian.laskawiec)Cool, will give this a try, thanks!