Eureka Server stand-alone building

Stand-alone environment to build 
1, create xc-govern-center project: packet structure: com.xuecheng.govern.center
2, adding a dependency
on the parent project has the added :( not have to repeat added)

to add Eureka Server project:
<dependency> < groupId> org.springframework.cloud </ groupId> < artifactId> spring-cloud-dependencies </ artifactId> <version> Dalston.SR5 </ version> <type> pom </ type> <scope> import </ scope> < / dependency>  

. 3, starting class

4, @ EnableEurekaServer @EnableEurekaServer needed to identify the service on the service start Eureka class  
5, from other services and copy application.yml logback-spring.xml. Configure content application.yml follows:

registerWithEureka: other services need to be called upon to Eureka register
needs to be set to true need to find the target service from Eureka to call when: fetchRegistry
<the Dependencies>    
<!‐‐ 导入Eureka服务的依赖 ‐‐>     <dependency>         <groupId>org.springframework.cloud</groupId>         <artifactId>spring‐cloud‐starter‐eureka‐server</artifactId>     </dependency> </dependencies>  
@EnableEurekaServer//标识这是一个Eureka服务 @SpringBootApplication public class GovernCenterApplication {     public static void main(String[] args) {         SpringApplication.run(GovernCenterApplication.class, args);     } }  
server: port: 50101 # service port spring: application: name: xc- govern-center # specify the service name eureka: client: registerWithEureka: false # service registration, whether to register itself to Eureka Service fetchRegistry: false # service discovery, whether obtaining registration information from Eureka in serviceUrl: interactive address #Eureka client and service side of Eureka, high-availability configuration status of each other's addresses, configure their single status (if not the default configuration of the machine 8761 port) defaultZone: http: // localhost: 50101 / eureka / server: enable- self-preservation: false # whether to enable self-protection mode eviction-interval-timer-in- ms: 60000 # service registry cleanup interval (in milliseconds, default is 1000 * 60)  
serviceUrl.defaultZone configuration Eureka reporting service address
  current service is Eureka: high availability configuration state of each other's addresses, configure their own stand-alone status

is currently serving a non-Eureka: Eureka service will address all configurations, separated by commas enable-self-preservation: self-protection settings below have introduced .
eviction-interval-timer-in- ms: cleanup interval node failure, this period will be reported if the node does not receive the node removed from the list of services.
  5, start Eureka Server
starts Eureka Server, browse 50101 ports.

Description:

Eureka Server has more than a self-protection mode, when the micro services are no longer reported to the Eureka Server status, Eureka Server will this service be removed from the list of services, if the network anomalies occur (micro normal service), then enter the protection mode Eureka server no longer will be deleted from the list of services micro-services.
Proposed closure of self-protection mode during the development phase.




Guess you like

Origin blog.51cto.com/14500648/2430157