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
Add dependent
Modify application.properties
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
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)
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)