eureka


        org.springframework.boot
        spring-boot-starter-parent
        2.0.6.RELEASE
    

        
            
                org.springframework.cloud
                spring-cloud-dependencies
                Finchley.RELEASE
                pom
                import
            
        
    

服务端:

 
        
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-server
        
    
server:
  port: 8762

eureka:
  instance:
    hostname: localhost
    prefer-ip-address: true
    instance-id: ${eureka.instance.hostname}:${server.port}
  server:
    enable-self-preservation: false      # 关闭自我保护模式(默认为打开)
    eviction-interval-timer-in-ms: 5000  # 续期时间,即扫描失效服务的间隔时间(缺省为60*1000ms)
  client:
    register-with-eureka: false #不注册自己
    fetch-registry: false #不注册自己
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
spring:
  application:
    name: eureka-server

eureka_第1张图片

 

 客户端的配置:

 

 
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-client
        

 

server:
  port: 8100
myeureka:
  port: 8762

eureka:
  instance:
    hostname: localhost
    prefer-ip-address: true
    instance-id: ${eureka.instance.hostname}:${server.port}
  client:
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${myeureka.port}/eureka/
spring:
  application:
    name: studentimpl

eureka_第2张图片

 eureka 设置权限访问:

 
    org.springframework.boot
    spring-boot-starter-security


2.在application.properties加入认证的用户名和密
security.user.name=你的用户名
security.user.password=你的密码

3.在访问路径上加入用户名密码
eureka.client.serviceUrl.defaultZone=http://${security.user.name}:${security.user.password}@127.0.0.1:${server.port}/eureka/

现在访问需要输入用户名密码,访问路径格式

 

     org.springframework.boot    spring-boot-starter-security
2.在application.properties加入认证的用户名和密security.user.name=你的用户名security.user.password=你的密码
3.在访问路径上加入用户名密码eureka.client.serviceUrl.defaultZone=http://${security.user.name}:${security.user.password}@127.0.0.1:${server.port}/eureka/

你可能感兴趣的:(eureka)