In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to build and configure the Eureka server of springcloud architecture, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Springcloud related knowledge and environment deployment, and build a set of springcloud distributed framework:
The first step is to create a normal springboot project
The following methods can quickly create a boot project:
The browser visits http://start.spring.io/, fills in the information, downloads the zip package, and presses it to your ide workspace for direct use.
Use idea to automatically generate boot projects (if you have not created your own Baidu …... )
Use eclipse to create a boot project (if you have not created your own Baidu … )
The second step is to add dependencies to pom.xml (here are my complete dependencies)
4.0.0 com.eureka.server eureka-server-001 0.0.1 eureka-server-001 Maven Webapp http://maven.apache.org org.springframework.boot spring-boot-starter-parent 1.5.4.RELEASE UTF-8 UTF-8 1.8 Dalston.SR4 junit Junit test org.springframework.cloud spring-cloud-starter-eureka-server org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-netflix-core Com.google.guava guava org.springframework springloaded org.springframework.boot spring-boot-devtools true de.codecentric spring-boot-admin-starter-client 1. 3.2 org.springframework.boot spring-boot-starter-actuator org.jolokia jolokia-core org.springframework.boot spring-boot-starter-security org.springframework. Cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin
Third, modify the configuration file application-dev.properties
Change the application.properties file name to application-dev.properties. This is a production environment.
Add content
# appname default spring.application.name=Eureka-H.A.# registration port number server.port=8761#--- writer-related information-writer related information- -info.owner=LTYinfo.version=@project.version@info.app.name=@project.name@info.app.version=@project.version@info.app.description=@project.description@info.app.spring-boot-version=@project.parent.version@# Security Certification security.basic.enabled=falsesecurity.user.name=adminsecurity.user.password=123456spring.boot.admin.url= http://localhost:8080# Service and Discovery related Information-Service and Discovery related Information-# do not use hostnames to define the address of the registry In the form of an IP address, if a property is set, the IP configured with that property is used Otherwise, automatically obtain the first IP address except the loop IP # show the ipeureka.instance.prefer-ip-address=true#IP address when registered # whether the eureka.instance.ip-address=localhost# is registered as the service eureka.client.register-with-eureka=false# whether to retrieve the host name of the service eureka.client.fetch-registry=false# set the current instance eureka.instance.hostname=localhost# define the call interval of the service renewal task (heartbeat) Unit: second eureka.instance.lease-renewal-interval-in-seconds=30# defines the service expiration time. Unit: second eureka.instance.lease-expiration-duration-in-seconds=90# status page URL, relative path. Default is HTTP access. If you need to use HTTPS, you need to use absolute path to configure URL of eureka.instance.status-page-url-path=/info# health check page, relative path, default access using HTTP. If you need to use HTTPS, you need to use the absolute path to configure the URL of the eureka.instance.health-check-url-path=/health# health check page. The absolute path eureka.instance.health-check-url=/# closes the registry protection mechanism. Eureka will calculate that the rate of heartbeat failure within 15 minutes is less than 85%. The protection mechanism will be triggered without excluding the service provider. If the service registry is closed, the unavailable instances will be removed correctly # turn off self-protection (this option is turned on during production) the interval between eureka.server.enable-self-preservation=true# scanning for failed services (default is 60*1000ms) the address of the eureka.server.eviction-interval-timer-in-ms=5000#eureka default space eureka.client.service-url.defaultZone= http://localhost:8761/eureka/
Step 4, add application.yml
Spring: profiles: active: dev
Step 5, modify the Application class
Add comment
@ EnableEurekaServer this annotation indicates that the application is an eureka service, and it can combine multiple services as clusters to provide service registration and discovery functions.
@ SpringBootApplication (startup notes that come with the created boot project, some configurations will be loaded)
Modify the main () method
Public static void main (String [] args) {new SpringApplicationBuilder (EurekaServerApplication.class) .web (true) .run (args);}
Step 6, start the Application class
Write the picture description here.
Configuration complete!
Thank you for reading this article carefully. I hope the article "how to build and configure the Eureka server of springcloud architecture" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.