Zipkin data not able to persist in Elastic search - elasticsearch

I am having problem persisting the zipkin data. I did not get any error message. So I am sharing configuration to get a help.
I can see my logs in zipkin UI, but not able to persist in elastic search.
My zipkin-service pom file shared below.
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-elasticsearch-http</artifactId>
<version>2.0.0</version>
</dependency>
<!-- add the dependency for elasticsearch via http -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
And my properties looks like this
spring:
profiles: local
rabbitmq:
host: ${RABBIT_HOST:localhost}
username: test
password: test
zipkin:
storage:
type: elasticsearch
elasticsearch:
jest:
uris: http://localhost:9200

Related

SpringBoot JPA save in Impala

I develop a web service whit springboot and I need it save some info in my impala database.
I searching about save in impala and I only find how to use the JDBC.
Someone know if I can use spring boot and spring jpa to save data in impala?
My .yml
server:
port: 8080
spring:
config:
name: **
cloud:
loadbalancer:
ribbon:
enable: false
datasource:
url: jdbc:impala://...
username: ...
password: ...
driver-class-name: io.opentracing.contrib.jdbc.TracingDriver (I think this is not the correct but i find another)
My pom.xml
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>com.cloudera.impala.jdbc</groupId>
<artifactId>ImpalaJDBC41</artifactId>
<version>2.6.4.1005</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>db-caf-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>rest-caf-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>test-caf-boot-starter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>es.caser.archit.spring</groupId>
<artifactId>security-caf-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
Thanks :D
The driver class name should be
driverClassName: org.apache.hive.jdbc.HiveDriver
And use this dependency
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>3.1.2</version>
</dependency>

Spring boot config client not resolving config server

Config client cannot resolve configuration property and cannot connect to config server.
Here's my service application.properties file:
spring.application.name = idmanager-service
spring.cloud.config.uri = http://localhost:8888
server.port=8081
#enable actuator endpoints
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
info.app.name=Id management Application
info.app.description=managing citizens identities
info.app.version=0.1.0
The dependencies in pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- Lmobok Dependency-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
<!-- / Lmobok Dependency-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<!--<version>RELEASE</version>-->
<scope>compile</scope>
</dependency>
<!-- Eureka discovery client-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<!-- Config client-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<!-- Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
The config server and the discovery server started successfully and other services are successfully registered.
Here's the config server application.properties file:
server.port=8888
spring.cloud.config.server.git.uri=file:./src/main/resources/myConfig
The application.properties file in myConfig folder:
global=xxxxx
Other services are successfully registered and fetching config server:
c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
I resolved this issue by fixing Spring cloud version like below:
<spring-cloud.version>Hoxton.SR3</spring-cloud.version>
Then I specified the Spring cloud dependency version using dependency management:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Unable to find zuul properties in application.yml

Unable to find below zuul properties in application.yml attached the pom.xml.
I hope I added the necessary dependency or do I missing anything.
How to connect the services with gateway.
application.yml
zuul.routes.hello.path=/hello/**
zuul.routes.hello.serviceId=Beginner-Microservice
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
The reference link
https://javabeginnerstutorial.com/spring-boot/spring-boot-2-microservices-with-netflix-zuul-api-gateway/
The spring cloud version which I have used is
<spring-cloud.version>Finchley.M8</spring-cloud.version>
Kindly help me in this regard

use Zipkin+ElasticSearch+Sleuth+rabbitMQ can't find "services"

SpringCloud version:Dalston.SR1,
rabbitMQ version:3.6.10,ElasticSearch version:6.2.4
There was nothing unusual when I use MySQL as a storage.
Now I use ElasticSearch.I can't find any services.
I lost something?
here is the picture:
application.properties
server.port=11008
spring.application.name=microservice-zipkin-stream-server-es
spring.sleuth.enabled=false
spring.sleuth.sampler.percentage=1.0
zipkin.storage.StorageComponent = elasticsearch
zipkin.storage.type=elasticsearch
zipkin.storage.elasticsearch.cluster=elasticsearch-zipkin-cluster
zipkin.storage.elasticsearch.hosts=127.0.0.1:9300
zipkin.storage.elasticsearch.max-requests=64
zipkin.storage.elasticsearch.index=zipkin
zipkin.storage.elasticsearch.index-shards=5
zipkin.storage.elasticsearch.index-replicas=1
spring.rabbitmq.host=192.168.0.162
spring.rabbitmq.port=5672
spring.rabbitmq.username=basefrm
spring.rabbitmq.password=basefrm
eureka.instance.hostname=192.168.0.162
eureka.client.serviceUrl.defaultZone=http://192.168.0.162:8761/eureka/
management.security.enabled=false
pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-elasticsearch-http</artifactId>
<version>2.4.1</version>
<optional>true</optional>
</dependency>
You're using an ancient version of Sleuth, can you please upgrade? Why do you provide Zipkin's version manually? Also as far as I see you're using the Sleuth's Zipkin server (that is deprecated in Edgware and removed in Finchley). My suggestion is that you stop using the Sleuth's Stream server (you can read more about this here https://cloud.spring.io/spring-cloud-static/Edgware.SR3/single/spring-cloud.html#_sleuth_with_zipkin_via_rabbitmq_or_kafka).
<dependencyManagement> (1)
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${release.train.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency> (2)
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency> (3)
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
</dependency>
1) In order not to pick versions by yourself it’s much better if you add the dependency management via the Spring BOM
2) Add the dependency to spring-cloud-starter-zipkin - that way all dependent dependencies will be downloaded
3) To automatically configure rabbit, simply add the spring-rabbit dependency

Netflix OSS Eureka Spring boot 2.0 app on K8s returning name instead of ip address

I am trying to deploy a spring boot netflix OSS discovery server on kubernetes. The server deploys fine and my apps register with the server and I even get an instance url back when I query the using the Eureka client.
#Autowired
private EurekaClient discoveryClient;
#GetMapping("/get_instance/")
public String serviceUrl() {
return getUrlFromEureka();
}
private String getUrlFromEureka() {
InstanceInfo instance = discoveryClient.getNextServerFromEureka("DEMO-SERVER", false);
return instance.getHomePageUrl();
}
This returns a url like this http://demo-server-86c7cd568-xzzgt:8080/
This returns the name of the pod and the ports it is on so I try to query this to get response from the server but it times out.
This is the method I use
#GetMapping("/get-from-demo-server")
public String getFromDemoServer(){
RestTemplate restTemplate = new RestTemplate();
return restTemplate.getForObject(getUrlFromEureka(), String.class);
}
I deploy the discovery server and the spring boot apps to the same k8's environment.
Here is my bootstrap.yml for eureka server.
Here is a screen shot of the eureka server running in k8's.
screenshot
This is all running in my local minikube environment.
Thanks for any help that I receive.
Here is the dependencies for my client
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/net.logstash.logback/logstash-logback-encoder -->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Here are the dependencies for the Eureka server
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
The issue is by default the client prefers the hostname and not the ip. You can override that with a spring property.
eureka.instance.prefer-ip-address= true.
This worked perfect for my use case.

Resources