我们有一个非常简单的Spring Boot Service( @EnableConfigServer
)在一个nginx代理之后运行。
该服务基本上工作,但它始终重新启动(上下文closures,并不断启动)。
在这里查看日志文件: http : //pastebin.com/GErCF5x6
该设置基本上只是一个Java类和两个configuration(bootstrap.properties以及application.properties)。
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.cloud.config.server.EnableConfigServer; import org.springframework.context.annotation.Configuration; /** * Main Application, which starts the Spring Boot context */ @Configuration @EnableAutoConfiguration @EnableConfigServer public class Application { @SuppressWarnings("PMD.SignatureDeclareThrowsException") public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } }
bootstrap.properties
spring.application.name = configserver spring.cloud.config.enabled = false encrypt.failOnError= false encrypt.key= secret
application.properties
# HTTP Configuration server.port = 8888 # Management Configuration management.context-path=/manage # SSH Based Git-Repository spring.cloud.config.server.git.uri=git@bitbucket.org:xyz.git spring.cloud.config.server.git.basedir = cache/config security.user.name=ads security.user.password={cipher}secret2 security.basic.realm=Config Server
日志文件
11:13:47.105 [qtp1131266554-101] INFO osboot.SpringApplication - Started application in 0.176 seconds (JVM running for 245.66) 11:13:47.105 [qtp1131266554-101] INFO oscaAnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7709b120: startup date [Wed Apr 08 11:13:47 UTC 2015]; root of context hierarchy 11:13:47.690 [qtp1131266554-51] INFO osbaaudit.listener.AuditListener - AuditEvent [timestamp=Wed Apr 08 11:13:47 UTC 2015, principal=ads, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffffe21a: RemoteIpAddress: 10.10.100.207; SessionId: null}] 11:13:48.324 [qtp1131266554-19] INFO osboot.SpringApplication - Starting application on api01.prd.rbx.xxxx.com with PID 24204 (started by ads in /home/ads/config-server) 11:13:48.328 [qtp1131266554-19] INFO oscaAnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@473cffd3: startup date [Wed Apr 08 11:13:48 UTC 2015]; root of context hierarchy 11:13:48.332 [qtp1131266554-19] INFO osboot.SpringApplication - Started application in 0.092 seconds (JVM running for 246.887) 11:13:48.332 [qtp1131266554-19] INFO oscaAnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@473cffd3: startup date [Wed Apr 08 11:13:48 UTC 2015]; root of context hierarchy 11:13:48.612 [qtp1131266554-55] INFO osbaaudit.listener.AuditListener - AuditEvent [timestamp=Wed Apr 08 11:13:48 UTC 2015, principal=ads, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@ffffe21a: RemoteIpAddress: 10.10.100.207; SessionId: null}] 11:13:50.601 [qtp1131266554-77] INFO osboot.SpringApplication - Starting application on api01.prd.rbx.xxxx.com with PID 24204 (started by ads in /home/ads/config-server) 11:13:50.604 [qtp1131266554-77] INFO oscaAnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@44330486: startup date [Wed Apr 08 11:13:50 UTC 2015]; root of context hierarchy 11:13:50.607 [qtp1131266554-77] INFO osboot.SpringApplication - Started application in 0.088 seconds (JVM running for 249.162) 11:13:50.607 [qtp1131266554-77] INFO oscaAnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@44330486: startup date [Wed Apr 08 11:13:50 UTC 2015]; root of context hierarchy 11:13:51.831 [qtp1131266554-55] INFO osboot.SpringApplication - Starting application on api01.prd.rbx.xxxx.com with PID 24204 (started by ads in /home/ads/config-server) 11:13:51.834 [qtp1131266554-55] INFO oscaAnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1843040d: startup date [Wed Apr 08 11:13:51 UTC 2015]; root of context hierarchy 11:13:51.840 [qtp1131266554-55] INFO osboot.SpringApplication - Started application in 0.094 seconds (JVM running for 250.395)
任何想法,如何解决这个问题?
最好的,弗里茨
这很正常。 这不是启动和停止的应用程序,而是用于为远程客户端创建配置资源的小型上下文。 完全无害。
所以,配置服务器不重新启动。 它使用一个新的Spring应用程序上下文,并将它从git中抓取的文件加载到一个新的上下文中,并将这些值格式化以发送回客户端。 下面是来自我的配置服务器的一个客户端连接的日志。 日志只是看起来像重新启动混乱。
2015-04-08 12:22:52.206 INFO 85076 --- [nio-8888-exec-1] osbaaudit.listener.Auditlistner : AuditEvent [timestamp=Wed Apr 08 12:22:52 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null}] 2015-04-08 12:22:52.944 INFO 85076 --- [nio-8888-exec-2] osbaaudit.listener.Auditlistner : AuditEvent [timestamp=Wed Apr 08 12:22:52 EDT 2015, principal=user, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null}] 2015-04-08 12:22:53.490 INFO 85076 --- [nio-8888-exec-1] osboot.SpringApplication : Starting application on sgibb-mbp.local with PID 85076 (started by sgibb in /Users/sgibb/workspace/spring/spring-cloud-samples/configserver) 2015-04-08 12:22:53.494 INFO 85076 --- [nio-8888-exec-1] scaAnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@571e4b84: startup date [Wed Apr 08 12:22:53 EDT 2015]; root of context hierarchy 2015-04-08 12:22:53.497 INFO 85076 --- [nio-8888-exec-1] faAutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2015-04-08 12:22:53.498 INFO 85076 --- [nio-8888-exec-1] osboot.SpringApplication : Started application in 0.151 seconds (JVM running for 23.747) 2015-04-08 12:22:53.499 INFO 85076 --- [nio-8888-exec-1] osccsNativeEnvironmentRepository : Adding property source: file:/Users/sgibb/workspace/spring/spring-cloud-samples/configserver/target/config/foo.properties 2015-04-08 12:22:53.500 INFO 85076 --- [nio-8888-exec-1] osccsNativeEnvironmentRepository : Adding property source: file:/Users/sgibb/workspace/spring/spring-cloud-samples/configserver/target/config/application.yml 2015-04-08 12:22:53.500 INFO 85076 --- [nio-8888-exec-1] scaAnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@571e4b84: startup date [Wed Apr 08 12:22:53 EDT 2015]; root of context hierarchy 2015-04-08 12:22:54.090 INFO 85076 --- [nio-8888-exec-2] osboot.SpringApplication : Starting application on sgibb-mbp.local with PID 85076 (started by sgibb in /Users/sgibb/workspace/spring/spring-cloud-samples/configserver) 2015-04-08 12:22:54.096 INFO 85076 --- [nio-8888-exec-2] scaAnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@416d044c: startup date [Wed Apr 08 12:22:54 EDT 2015]; root of context hierarchy 2015-04-08 12:22:54.098 INFO 85076 --- [nio-8888-exec-2] faAutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2015-04-08 12:22:54.099 INFO 85076 --- [nio-8888-exec-2] osboot.SpringApplication : Started application in 0.433 seconds (JVM running for 24.348) 2015-04-08 12:22:54.099 INFO 85076 --- [nio-8888-exec-2] osccsNativeEnvironmentRepository : Adding property source: file:/Users/sgibb/workspace/spring/spring-cloud-samples/configserver/target/config/foo.properties 2015-04-08 12:22:54.099 INFO 85076 --- [nio-8888-exec-2] osccsNativeEnvironmentRepository : Adding property source: file:/Users/sgibb/workspace/spring/spring-cloud-samples/configserver/target/config/application.yml 2015-04-08 12:22:54.099 INFO 85076 --- [nio-8888-exec-2] scaAnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@416d044c: startup date [Wed Apr 08 12:22:54 EDT 2015]; root of context hierarchy
我发现了我在这里面临的问题。 基本上,我们有两个在AWS上运行的远程服务和一个配置的Load Balanacer,它持续检查/ health端点。 通过调用这个方法,ConfigserverClient总是调用我们的Configserver。
我不明白为什么Configserver有一个HealthIndicator,有没有办法禁用这个HealthIndicator,因为对这个端点的每个请求都会一次又一次的查询我们的配置服务器。 另一个缺点是,/ health请求不能尽快响应,这会导致Load Balancer超时(默认2秒)。