spring cloud registry eureka

eureka Registration Center (stand-alone)

1. Create a eureka project
2. Configure dependent pom.xml
3. Configure application.yml
4. The main program enabled eureka discovery annotation
5. Modify the hosts file
6. Start to access the test

Create a eureka-server project: sp05-eureka

Here Insert Picture Description
Add dependent
Here Insert Picture Description

Modify application.properties

Here Insert Picture Description

Configuration profiles yml

spring:
  application:
    name: eureka-server
    
server:
  port: 2001
#eureka的自我保护模式
eureka:
  server:
    enable-self-preservation: false
#eureka的主机名
  instance:
    hostname: eureka1
#不像自身注册,不向自身拉取注册信息    
  client:
    register-with-eureka: false
    fetch-registry: false  

Add @EnableEurekaServer notes in the main program

Here Insert Picture Description

Modify the hosts file

To C: \ Windows \ System32 \ drivers \ etc \ hosts
add in the file `

127.0.0.1  eureka1.com

Tips There is a small software can modify the hosts directly (attention must be run as an administrator, or do not have permission)
Here Insert Picture Description
If you can not understand See Jane books

Testing, access

Visit http: // localhost: 2001 /
or http://eureka1.com:2001/ (This is the reason why the modification of hosts)
Here Insert Picture Description
Here Insert Picture Description

Released three original articles · won praise 0 · Views 116

Guess you like

Origin blog.csdn.net/weixin_45482334/article/details/104592834