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

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

Related

Hazelcast +Sring Boot + Kubernetes - How to setup Client-Server topology

I'm trying to see how to configure Client-Server with my Spring Boot application using Hazelcast on Kubernete, since we want to have the capability of sharing the cache between different Spring Boot applications (I'm already able to setup the Embedded distributed cache with Kubernetes - which is not what we need).
In case of Spring Boot single application(not on Kubernetes), its kind of easy where i will spin up a Server lets say with 'localhost' and also spin up the client connecting to localhost. Also i can have multiple instances(members) of Server which will form a Hazelcast Cluster.
However in case of Kubernetes, I know we need to have 2 different Spring Boot applications, one will act as a Server and others will be client accessing the cache, but want to know how the client would connect to the Server. Because in case of Spring we Autowire the HazelcastInstance, so how would i connect to the Server which is running in its own Kubernetes Pod ( and container).
There are a few deployment guides for Kubernetes here, and worked examples here & here.
If your server pods are joining, then you pretty much have it. A client uses the same discovery mechanism.
Add the hazelcast-kubernetes plugin to the client's pod, and set the configuration properties with the same values as you use on the server for namespace, dns, etc.
Thanks Neil. As you indicated its the same way i currently configured in embedded caching on Kubernetes. I'am using the Service-Name and namespace to discover and connect to the Server members from HazelcastClient instance.
This is from Client Spring Boot application's HazelcastConfiguration:
#Bean
public HazelcastInstance hazelcastInstance() {
final ClientConfig config = new ClientConfig();
config.setClusterName("cluster-name");
if (enableOnK8s) {
config.getNetworkConfig().getKubernetesConfig().setEnabled(true)
.setProperty("namespace", namespaceValue)
.setProperty("service-name", serviceName);
}
return HazelcastClient.newHazelcastClient(config);
}
And on Hazelcast Server Spring Boot application, configuration stays same as Embedded Hazelcast configuration.

Spring Boot Actuator + Spring Boot Admin - Is there a way to define a custom management url?

Is there a way I can define the port for the management URLs (not the management.server.port) so that spring boot admin can identify the actuator URLs from the spring boot app for monitoring?
I'm running the spring boot app in a docker container and it's externally exposed on a different port using the Kubernetes NodePort.
If you are using service discovery for application lookup you could define the exposed management port in instance metadata. This metadata is used to build up the management URL.
More details documented here:
http://codecentric.github.io/spring-boot-admin/current/#spring-cloud-discovery-support
Handling is done in de.codecentric.boot.admin.server.cloud.discovery.DefaultServiceInstanceConverter
Example for Eureka:
eureka.instance.metadata-map.management.port=[K8S-EXPOSED-PORT]
If you are using Service Discovery, take a look into DefaultServiceInstanceConverter, try specifying the management.port property.
If you are not using Service Discovery, then take a look into de.codecentric.boot.admin.server.domain.values.Registration, you might need to use the builder apis to register your application correctly (try to set managementUrl properly). Note, you will need to do this in your client application (the one which is being monitored).

Is it possible to deploy multiple Spring Boot applications to a server?

We can create restful API in spring boot jar file?
1)can we split multiple jar file in Apache server?
2) if we split multiple jar file how will identify which jar contain correct rest APIs
How spring boot jar file will work in server?
For Development Environment
You can configure ports via application.properties or via system properties.
Or with option to jvm --server.port=8081
So, there is no problem to run a few APIs on single machine with different ports.
You don't need Apache Server. Spring Boot has it's own embedded for you. So, you can easily use it.
Let's say you have two APIs.
localhost:8081 (Checkout Service)
localhost:8082 (Payment Service)
Hostname and port - it's your identification for each service.
When you trying to search something in Google.
You browser - it's a client.
And Google's servers - it's a server.
The same here. Checkout Service trying to delegate some job to Payment Service. So, Checkout Service - it's a client. And this client should know the address of Payment Service.
For Production Environment
You should think twice, how you will monitor performance, manage scalability and so on.

Spring cloud registering multiple instances of same service

I am developing a microservice, using Spring Boot, that exposes REST Endpoint. Because of scalability, I have to run multiple instances of this services on a different port. What will be the configurations for the applications so that it can register with eureka and requests are load balanced? I am using Spring cloud config, Eureka server and zuul.
Attaching following entries in the client properties file will do the trick. This is for Spring cloud config dalston
eureka.instance.instanceId=${spring.application.name}:${spri‌​ng.application.insta‌​nce_id:${random.valu‌​e}}
I guess you meant to register with Eureka instead of Config server.
To register multiple instances that might be running in the same host but listening on a different port you would need to set eureka.instance.metadataMap.instanceId to a unique value maybe using:
eureka.instance.metadataMap.instanceId=${spring.application.name}:${random.int}

how to connect with gemfire running on local machine using spring data gemfire with annoatations

I have tried so many demos but I am not able to create region on my local gemfire .
my code is running in embedded mode but I want to run it as client server mode with using annotions how should I do this.
Thanks.
Your problem description is pretty vague.
You should have a look at my pivotal-gemfire-clientserver-examples that compares and contrasts using native GemFire configuration (both cache.xml and then using GemFire's Java API) vs. Spring configuration (again using both Spring XML as well as Spring Java configuration meta-data).
For instance, you can see here that I configured and bootstrapped a GemFire Server using Spring Boot along with a Java configuration class. The GemFire cache client is my test class (along with the client-side Java config), but easily could have been another standalone, Spring Boot application.
Another, interesting tidbit, is that you can connect to the Spring Boot, GemFire Server application using Gfsh once the server is up and running. To connect in gfsh, use...
gfsh>connect --jmx-manager=localhost[1199]
Hope this helps!
-John

Resources