Small D Class - New version of the micro-services springcloud + Docker tutorial _3-05 service registration and discovery Eureka Server to build combat

notes


5, service registration and discovery Eureka Server to build combat
    Summary: IDEA build Eureka Center Server and start the end, the project introduces the basic skeleton of
    
    official documents: http: //cloud.spring.io/spring-cloud-netflix/single/spring- cloud-netflix.html # spring-cloud- eureka-server

    step 1: create project
    step two: add annotations @EnableEurekaServer
    The third step: to increase the allocation application.yml
            Server:
              Port: 8761

            Eureka:
              instance:
                hostname: localhost
              Client:
              # declare himself a server
                registerWithEureka: false
                fetchRegistry: false
                serviceUrl:
                  defaultzone: HTTP: // $ {eureka.instance.hostname}: $ {server.port} / Eureka /

    Step Four: Visit registry page

    maven Address: https://www.cnblogs.com/sword-successful/p/6408281.html

Start



https://start.spring.io/







because we have to do now configure the registry. So here Eureka Server Select this option on it.


Confirm the good path and project name, direct finish

and then will automatically download a lot of jar packets based on network availability
can maven repository address into Ali cloud
bottom right corner choose to automatically import the relevant dependent


when pom.xml and the school spring boot there is no difference, it may be the only difference is that the dependence of a eureka

is an empty project


https://cloud.spring.io/spring-cloud-netflix/reference/html/#spring-cloud-eureka-server

startup class inside annotated


Standalone mode: singleton. Here is application.yml profile

code that the code we create is application.properties formats

so we have to modify the configuration file format. Yml format into

the format of the suffix into yml


copy the code official documents of the case in the past.

server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

Each indent is two spaces. between the key and value is a space



launch program




is not currently registered with the instance of the application center







 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11440946.html