table of Contents:
Eureka basis springcloud fee of words
springcloud fee if the Eureka clusters
springcloud fee if the Eureka Service Access (restTemplate)
springcloud fee if the Eureka interface call (feign)
springcloud fee if the circuit breaker (hystrix in feign)
springcloud distribution center base fee of words (SVN)
springcloud fee if the client distribution center (SVN)
springcloud configuration center, the config-server port of 8888 can only issue more disgusting
The reason is that spring to write the code to get the configuration died each client, are the 8888 request, so the problem is on the client
However, the server must also be a certain degree of modification
Ideas:
Modify the config server port, into a non-8888 port
Modify config client gets the configuration of the way, from a fixed ip and port, modify the registry by eureka, to get registered by name
The config server-side add eureka registry
The actual code is as follows:
Modify config-server configuration is as follows:
server:
port: 9999
tomcat:
max-threads: 10000
max-connections: 20000
eureka:
client:
ServiceUrl:
defaultZone: http://localhost:10086/eureka/
spring:
application:
name: config-server
profiles:
active: subversion
cloud:
config:
server:
svn:
uri: https://xxxxxx/svn/liuyuhang_FM/configCenter/
username: liuyuhang
password: xxxxxx
search-paths: null
default-label: testConfig
basedir: /data
Modify config-client configuration is as follows:
server:
port: 8889
tomcat:
max-threads: 10000
max-connections: 20000
spring:
application:
name: config-client
cloud:
config:
discovery:
enabled: true
service-id: config-server
profiles:
active: dev
eureka:
client:
ServiceUrl:
defaultZone: http://localhost:10086/eureka/
Note spring of application of the name must be correct
Note that in the config-client discovery, we should enable is true, that may be found in
Then specify the service-id, instead of the previous configuration to uri
Because config-server content eureka added as a client, POM need to introduce a eureka, the following excerpt:
<!-- eureka server的jar, 作为client也需要 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> <!-- eureka client的jar --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
After adding, config-server need to add annotations to the client of the boot entry eureka, the following code excerpt:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) @EnableEurekaClient @EnableConfigServer public class ConfigApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(ConfigApplication.class, args); } }
Above ~