Spring cloud microservices communication

jr0000
HOBBY

a year ago

I am trying to configure my clients to register with my eureka server, I am using http, the name of the service and the listening port of my application, according to the documentation on how to connect services over the internal network. But it hasn't worked for me, could someone tell me if I'm building the URLs wrong or if doing this is not possible!!

URL -> *

--> http://avineserver_eureka:8090/eureka
[2024-04-23 03:18:006] [ main ] [ INFO ] [com.netflix.discovery.DiscoveryClient:1041] Getting all instance registry info from the eureka server

[2024-04-23 03:18:007] [ main ] [ INFO ] [com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient:84] Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://avineservereureka:8090/eureka/}, exception=I/O error on GET request for "http://avineservereureka:8090/eureka/apps/";: avineservereureka: Name or service not known stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://avineservereureka:8090/eureka/apps/";: avineserver_eureka: Name or service not known

--> http://avineserver_eureka.railway.internal:8090/eureka
[2024-04-23 03:30:043] [ main ] [ INFO ] [com.netflix.discovery.DiscoveryClient:1041] Getting all instance registry info from the eureka server

[2024-04-23 03:30:044] [ main ] [ INFO ] [com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient:84] Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://avineservereureka.railway.internal:8090/eureka/}, exception=I/O error on GET request for "http://avineservereureka.railway.internal:8090/eureka/apps/";: avineservereureka.railway.internal: Name or service not known stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://avineservereureka.railway.internal:8090/eureka/apps/";: avineserver_eureka.railway.internal: Name or service not known

--> http://avineservereureka.railway.internal/eureka [2024-04-23 03:35:012] [ main ] [ INFO ] [com.netflix.discovery.DiscoveryClient:1041] Getting all instance registry info from the eureka server [2024-04-23 03:35:012] [ main ] [ INFO ] [com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient:84] Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://avineservereureka.railway.internal/eureka/}, exception=I/O error on GET request for "http://avineservereureka.railway.internal/eureka/apps/";: avineservereureka.railway.internal: Name or service not known stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://avineservereureka.railway.internal/eureka/apps/";: avineservereureka.railway.internal: Name or service not known

14 Replies

a year ago

Is the eureka service located in the same project as the service that's trying to access it?


jr0000
HOBBY

a year ago

Not.

I see what the problem is, I'll make the corrections and I'll try again.


a year ago

Yes you can, click the + New button in the top right of an already existing project.

The private networks are isolated to each projects environments, it wouldn't be very private if any service from any project could access every service in any project.


jr0000
HOBBY

a year ago

I see what the problem is, I'll make the corrections and I'll try again.


a year ago

For what it's worth, this forum is realtime, we can see each others edits and new messages in real time.


jr0000
HOBBY

a year ago

I adjusted the project, now the microservices are all within it, but an error was generated which I cannot understand because in the local environment the Service Registration and Discovery works well.

[2024-04-23 19:43:047] [ main ] [ INFO ] [com.netflix.discovery.DiscoveryClient:1041] Getting all instance registry info from the eureka server

[2024-04-23 19:43:048] [ main ] [ INFO ] [com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient:84] Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://avineserver_eureka.railway.internal:8091/eureka/}, exception=Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.cloud.netflix.eureka.http .EurekaApplications] and content type [text/html;charset=utf-8] stacktrace=org.springframework.web.client.UnknownContentTypeException: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.cloud.netflix .eureka.http.EurekaApplications] and content type [text/html;charset=utf-8]

at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:124)


a year ago

Are you sure it's running on port 8091?


jr0000
HOBBY

a year ago

If I am sure the service is running on port 8081.

But I have some doubts, to give you context, the repository only has the eureka server microservice and that has an environment variable ${PORT} by which I can indicate the port on which the microservice will be executed. Now, I understand that railway builds a Docker image to run the “.jar” executable. What I am not clear about is why the port listens to the Docker image, if I can configure the port and where to see the docker mapping ports.


a year ago

You just said 8081 but your error logs say 8091, was that a typo?

why the port listens to the Docker image

Sorry, but this sentence does not make technical sense.


jr0000
HOBBY

a year ago

Sorry, I correct… If I am sure the service is running on port 8091.

Java executables do not run within docker image?


a year ago

They do, but your sentence does not make technical sense, at least in English.

Are you sure your eureka app is listening on ipv6? - https://docs.railway.app/guides/private-networking#listen-on-ipv6


jr0000
HOBBY

a year ago

Yeah that's right. Update the application.yml

server:
port: ${PORT:8091}
address: "::"

Docker Port Mapping [HOSTPORT]:[CONTAINERPORT]

I'm sure the HOST_PORT is 8091, but I don't know the container's listening port.

Do you know how I can see it or configure it?


a year ago

The port your app listens on is the port you tell it to listen on.


jr0000
HOBBY

a year ago

That is, it is the same, it automatically takes the same one from the host.


Spring cloud microservices communication - Railway Help Station