Nyamkhuu Buyanjargal
Nyamkhuu Buyanjargal

Reputation: 649

How to run spring boot application multiple instance when get resource from config server?

I have Eureka server, Eureka zuul and config server. So I write a simple microservice. Then, running on 8686 port.

So I want to run that microservice on another port. I trying that command. But don't work.

java -Dserver.port=8687 -jar -Dlogging.file="bla.log" testMicro.jar --debug > "bla.log"&

I am confusing. Help me!

Upvotes: 0

Views: 2102

Answers (1)

Vladlen Gladis
Vladlen Gladis

Reputation: 1787

You have two ways to running your instances on different ports.

  1. user assignment of random port from a specified range:
server:
  port: ${random.int(8080,8090)}
  1. Set in property file from config server for testMicro microservice the following configurations:
spring:
  cloud:
    config:
      override-system-properties: false
      allow-override: true
      override-none: true

and then run again your jar with -Dserver.port=8687 property

Upvotes: 1

Related Questions