Commit 1b3d1770 by ypenglv

增加注册中心健康监测,剔除无效服务

1 parent 932af6d0
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:21000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:21000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:21000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:22000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:22000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:22000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
......
...@@ -3,13 +3,20 @@ package org.nafmii.eureka; ...@@ -3,13 +3,20 @@ package org.nafmii.eureka;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@SpringBootApplication @SpringBootApplication
@EnableEurekaServer @EnableEurekaServer
public class NafmiiEurekaApplication { public class NafmiiEurekaApplication extends WebSecurityConfigurerAdapter {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(NafmiiEurekaApplication.class, args); SpringApplication.run(NafmiiEurekaApplication.class, args);
} }
@Override
protected void configure(HttpSecurity security) throws Exception{
security.csrf().disable();
super.configure(security);
}
} }
...@@ -2,11 +2,18 @@ eureka: ...@@ -2,11 +2,18 @@ eureka:
instance: instance:
prefer-ip-address: true prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
lease-renewal-interval-in-seconds: 30 #心跳时间
lease-expiration-duration-in-seconds: 90 #过期时间
server:
enable-self-preservation: false
eviction-interval-timer-in-ms: 60000
responseCacheAutoExpirationInSeconds: 180
responseCacheUpdateIntervalMs: 30000
client: client:
registerWithEureka: false registerWithEureka: false
fetchRegistry: false fetchRegistry: false
serviceUrl: serviceUrl:
defaultZone: http://${spring.cloud.client.ip-address}:${server.port}/eureka/ defaultZone: http://admin:pwd1029384756@${spring.cloud.client.ip-address}:${server.port}/eureka/
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
nafmii: nafmii:
......
...@@ -6,7 +6,7 @@ eureka: ...@@ -6,7 +6,7 @@ eureka:
registerWithEureka: false registerWithEureka: false
fetchRegistry: false fetchRegistry: false
serviceUrl: serviceUrl:
defaultZone: http://${spring.cloud.client.ip-address}:${server.port}/eureka/ defaultZone: http://admin:pwd1029384756@${spring.cloud.client.ip-address}:${server.port}/eureka/
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
nafmii: nafmii:
......
...@@ -6,7 +6,7 @@ eureka: ...@@ -6,7 +6,7 @@ eureka:
registerWithEureka: false registerWithEureka: false
fetchRegistry: false fetchRegistry: false
serviceUrl: serviceUrl:
defaultZone: http://${spring.cloud.client.ip-address}:${server.port}/eureka/ defaultZone: http://admin:pwd1029384756@${spring.cloud.client.ip-address}:${server.port}/eureka/
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
nafmii: nafmii:
......
...@@ -7,3 +7,7 @@ spring: ...@@ -7,3 +7,7 @@ spring:
active: @env@ active: @env@
application: application:
name: eurka-server name: eurka-server
security:
user:
name: admin
password: pwd1029384756
\ No newline at end of file \ No newline at end of file
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://localhost:20000/eureka/ defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
prefer-ip-address: true lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
statusPageUrl: http://127.0.0.1:24000/swagger-ui.html prefer-ip-address: true
statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
spring: spring:
cloud: cloud:
gateway: gateway:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://localhost:20000/eureka/ defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
prefer-ip-address: true lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
statusPageUrl: http://127.0.0.1:24000/swagger-ui.html prefer-ip-address: true
statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
spring: spring:
cloud: cloud:
gateway: gateway:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://localhost:20000/eureka/ defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
prefer-ip-address: true lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
statusPageUrl: http://127.0.0.1:24000/swagger-ui.html prefer-ip-address: true
statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
spring: spring:
cloud: cloud:
gateway: gateway:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:22000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://127.0.0.1:20000/eureka defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true prefer-ip-address: true
statusPageUrl: http://127.0.0.1:22000/swagger-ui.html statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
logging: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
mybatis: mybatis:
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://localhost:20000/eureka/ defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
prefer-ip-address: true lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
statusPageUrl: http://127.0.0.1:23000/swagger-ui.html prefer-ip-address: true
statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
spring: spring:
quartz: quartz:
job-store-type: jdbc job-store-type: jdbc
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://localhost:20000/eureka/ defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
prefer-ip-address: true lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
statusPageUrl: http://127.0.0.1:23000/swagger-ui.html prefer-ip-address: true
statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
spring: spring:
quartz: quartz:
job-store-type: jdbc job-store-type: jdbc
......
eureka: eureka:
client: client:
serviceUrl: serviceUrl:
defaultZone: http://localhost:20000/eureka/ defaultZone: http://admin:pwd1029384756@127.0.0.1:20000/eureka
healthcheck:
enabled: true
instance: instance:
prefer-ip-address: true lease-expiration-duration-in-seconds: 30 #租期到期时间(默认90秒)
lease-renewal-interval-in-seconds: 10 #租期更新时间间隔(默认30秒)
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}
statusPageUrl: http://127.0.0.1:23000/swagger-ui.html prefer-ip-address: true
statusPageUrl: http://127.0.0.1:${server.port}/swagger-ui.html
spring: spring:
quartz: quartz:
job-store-type: jdbc job-store-type: jdbc
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!