1

I try to connect my spring application to the HCP Consul Discovery Service.

Running consul locally in dev mode works well.

consul agent -dev

application.yml file looks like this:

spring:
  cloud:
    consul:
      host: localhost
      port: 8500

However, when I try to connect to HCP Consul I get:

[catalogWatchTaskScheduler-1] org.springframework.cloud.consul.discovery.ConsulCatalogWatch: Error watching Consul CatalogServices
org.apache.http.conn.ConnectTimeoutException: Connect to HOST:8500 [HOST/IP] failed: Connect timed out

This is the configuration I use:

spring:
  cloud:
    consul:
      host: HCP_HOST
      port: 8500
      scheme: https

HCP Consul is available to public connections. I manage to see the members using the CLI command

consul members

This is the dependency I use in the pom.xml file

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-discovery</artifactId>
    <version>3.1.2</version>
</dependency>

What do I miss in my configuration?

Alexander Tilkin
  • 149
  • 1
  • 2
  • 13

1 Answers1

0

Check if the port 8501 with HTTPS scheme solves this issue.

See here the ports used for each protocol. HTTPS seems to be disabled by default.

v-rosa
  • 101
  • 1
  • 5