We build the following for the Eureka project of Honghu Cloud, the whole building process is simple, I will record every step of the construction process, I hope to help everyone.
Create a Maven project named Common-eureka, which inherits the Commonservice, and the specific pom.xml configuration file is as follows:
<?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>commonservice</artifactId> <version>0.0.1 -snapshot</version></parent><artifactid>commonservice-eureka</artifactid><packaging >jar</packaging><name>commonservice-eureka</name><description>commonservice Project For Spring boot</description><dependencies> <dependency> <groupid>org.springframework.cl Oud</groupid> <artifactId>spring-cloud-starter-eureka-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> &L T;groupid>org.springframework.boot</groupid> <artifactId>spring-boot-devtools</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artif Actid>spring-boot-starter-test</artifactid> <scope>test</scope> </DEPENDENCY></DEP endencies><build> <plugins> <plugin> <groupId>org.springframework.boot< /groupid> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <id>1</id> <goals> <goal>repackage</goal> </goals> </execution><execution> <id>2</id><goals><goal>build-info</goal></goals></execution> </executions> &L T;configuration> <executable>true</executable> </configuration> < /plugin> </plugins></build></project>
Package Com.ml.honghu;
Import org.springframework.boot.SpringApplication;
Import org.springframework.boot.autoconfigure.SpringBootApplication; Import Org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; Br/> @EnableEurekaServer
Springapplication.run (Serviceapplication.class, args);
}
}
Server (Eureka default port is: 8761)
server:port:8761 # Spring Spring:application:
Name:commonservice-erueka
Eureka Eureka:client:
Whether to register to Eureka
Register-with-eureka:true
Whether to obtain registration information from Eureka
Fetch-registry:false Availability-zones:honghu:honghuzone Service-url:
Honghuzone:http://honghu:[email protected]: 8761/eureka/defaultzone:http://honghu:[email protected]: 8761/eureka/instance:
Prefer-ip-address:true hostname:localhost metadataMap:zone:honghuZone User: ${security.user.name}
Password: {Security.user.password}
Specify the environment
Environment:dev
#指定数据中心
Datacenter:honghu
To turn off self-protected mode server:
Enable-self-preservation:false
#设置清理无效节点的时间间隔, default 60000, which is 60s
eviction-interval-timer-in-ms:60000
Service Certification Security:basic:
Enabled:true User:
Name:honghu password:123456management:security:
Enabled:false
4. Add the log mechanism of the project and the package run mechanism (we will write the package deployment mechanism for Linux CentOS in detail later) 5. Since this entire project was deployed, the run as-to-Spring Boot App was performed manually, and the results were as follows: Console run Result:! [] (http://i2.51cto.com/images/blog/201804/04/392d053c3ffdb61727a3d52f5001c6ca.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) Access the console and log in:! [] (http://i2.51cto.com/images/blog/201804/04/49def22f9dede18fd2963c15e0e88a65.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) Console Run Effect:! [] (http://i2.51cto.com/images/blog/201804/04/749b3f4fab252aea3733c71fa5119198.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=) 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 Technical support for complete project 1791743380**
Spring Cloud-honghu Cloud-distributed micro-service-eureka (vi)