0

I have tried starting Eureka service in peer to peer awareness with following profiles.

#profile 1:

spring:
  application:
    name: service-registry
  profiles: p1
server:
  port: 8761
eureka:
  dashboard:
    enabled: false
    override: true
  enableselfPresentation: true
  shouldUseDns: true
  instance:
    appname: ${spring.application.name}
    instanceId: ${random.value}
  client:
    registerWithEureka: false
    fetchRegistry: false

#profile 2:

spring:
  application:
    name: service-registry
  profiles: p2
server:
  port: 8762
eureka:
  dashboard:
    enabled: false
    override: true
  enableselfPresentation: true
  shouldUseDns: true
  instance:
    appname: ${spring.application.name}
    instanceId: ${random.value}
  client:
    registerWithEureka: false
    fetchRegistry: false

After starting eureka with these profiles, at eureka dashboard for port 8761 I see DS replica as localhost:8761 but not as localhost:8762 and on localhost:8762 DS replica as localhost:8761 How to make the replica of localhost:8761 as localhost:8762 and vice versa

Cœur
  • 37,241
  • 25
  • 195
  • 267
Arpit
  • 521
  • 2
  • 8
  • 22

1 Answers1

0

Found the solution for this added following config:

#profile p1
eureka
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8762/eureka/
#profile p2
eureka
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
Arpit
  • 521
  • 2
  • 8
  • 22
  • Providing different ports in the default zone may have solved your problem and it is good for the learning. But when it comes to actual production systems, if you're providing ports manually you're not utilizing the technology stack that you're using to the fullest. – zeagord Nov 08 '17 at 09:42
  • @mephis-slayer in actual production these ports can be passed from the command line arguments, correct me if I am wrong, or we have any other way? – Arpit Nov 09 '17 at 02:27
  • If you're using containers (docker) and the platform will take care of it and the ports are assigned dynamically. – zeagord Nov 09 '17 at 09:55