We reviewed the basics of Spring Cloud Eureka, and now we build on the Eureka project for Honghu Cloud, the entire build process is simple, and I'll record every step of the build process to help you:
1. Create a MAVEN project named Particle-common-eureka, inheriting Particle-commonservice, with the following pom.xml configuration file:
<?xml version="1.0"encoding="UTF-8"? ><project xmlns="http://maven.apache.org/POM/4.0.0"Xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.ml.honghu</groupId> <artifactid>part Icle-commonservice</artifactid> <version>0.0.1-snapshot</version> </parent> <artifactId>particle-commonservice-eureka</artifactId> < ;p ackaging>jar</packaging> <name>particle-commonservice-eureka</name> <description> Particle-commonservice Project for Spring boot</description> <dependencies> <dependency> <GROUPID>ORG.SPRINGFR Amework.cloud</groupid> <artifactId>spring-cloud-starter-eureka-server</artifactId> &L T;/dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot-devtools</arti factid> </dependency> <dependency> <groupid>org.springframework.boot </groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test< /scope> </dependency> </dependencies> <build> <plugins> <PL Ugin><groupId>org.springframework.boot</groupId> <artifactid>spring-boot-maven-plugin</arti factid> <executions> <execution> <id>1</id> <goals> <goal>repackage</goal> </goals> </execution> <execution> <id>2</id> <goals> <goal>build-info</goal> </goals> </execution> </executions> <co Nfiguration> <executable>true</executable> </configuration> </plugin> </PLUGINS&G T </build></project>
2. In the Boot class entry reference Eureka configuration, the code is as follows:
Package Com.ml.honghu; Import Org.springframework.boot.springapplication;import Org.springframework.boot.autoconfigure.springbootapplication;import Org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @springbootapplicationpublicclass serviceapplication { Public Static void Main (string[] args) { springapplication.run (serviceapplication. class , args);} }
3. Configuring the Application.yml File
# server (Eureka default port is:8761) Server:port:8761# springspring:application:name:particle-commonservice-Erueka # eurekaeureka:client: # Register to Eureka Register-with-eureka:true# Whether to get registration information from Eureka Fetch-registry:falseAvailability-Zones:honghu:honghuZone Service-url:honghuZone:http://Honghu:[email protected]:8761/eureka/Defaultzone:http://Honghu:[email protected]:8761/eureka/Instance:prefer-ip-address:truehostname:localhost metadataMap:zone:honghuZone User: ${security.user.name} password: {Securit Y.user.password} # Specify Environment Environment:dev #指定数据中心 Datacenter:honghu # Turn off self-protection mode server:enable-self-preservation:false#设置清理无效节点的时间间隔, default 60000, which is 60s eviction-interval-timer-inch-ms:60000# Service Certification security:basic:enabled:trueUser:name:honghu Password:123456management:security:enabled:false
4. Add the log mechanism of the project and the package operation mechanism (we will write the package deployment mechanism for Linux CentOS in detail later)
From now on, I will be documenting the process and essence of the recent development of the spring cloud micro-service cloud architecture to help more friends who are interested in developing the Spring cloud framework to explore the process of building the spring cloud architecture and how to use it in enterprise projects.
Spring Cloud Cloud Service architecture-Honghu Commonservice-eureka project build process