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> <arti Factid>particle-commonservice-eureka</artifactid> <packaging>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</i D> <goals> <goal>repackage</goal> </goals> </execution> <execution> < ;id>2</id> <goals> <goal>build-info</goal> </goals> </execution> </executions> <configuration> <executable>true</executable> </configuration> </plugin> </PLUGINS&G T </build></project>
2. In the Boot class entry reference Eureka configuration, the code is as follows:
PackageCom.ml.honghu;Importorg.springframework.boot.SpringApplication;Importorg.springframework.boot.autoconfigure.SpringBootApplication;ImportOrg.springframework.cloud.netflix.eureka.server.EnableEurekaServer, @ Enableeurekaserver@springbootapplication Public classserviceapplication { Public Static voidMain (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-in-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)
5. From the completion of this entire project deployment, the run as-to-Spring Boot App is performed manually with the following results:
Console Run Results:
To access the console and log in:
Console Run Effect:
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.
Source source technical support for complete projects 1791743380
Spring Cloud Cloud Service architecture-Honghu Commonservice-eureka project build process