当前位置:网站首页>Eureka usage record
Eureka usage record
2022-07-25 12:14:00 【dengjili】
Knowledge point 1, Self-protection model
Protection mode is mainly in a group of clients and Eureka Server Use when there are network partition scenarios between . Once in protected mode ,Eureka Server Will try to protect information in the registry of its services , Data in the service registry is no longer deleted . When the network is recovered , The Eureka Server The node automatically exits protected mode .
eureka.server.enableSelfPreservation=false
Knowledge point 2,Eureka Application example ID The name of the format
When the client registers , Service Instance ID The format of the default value for is as follows ( Host name : The service name : Service port ):
${
spring.cloud.client.hostname}:${
spring.application.name}:${
spring.application. instance_id:${
server.port}}
If you need to customize the format : The service name : Where the service is IP: Service port
eureka.instance.instance-id=${
spring.application.name}:${
spring.cloud.client.ip-address}:${
server.port}

At this time, the above link is still the hostname , Increase the configuration , Show as ip
eureka.instance.preferIpAddress=true

Custom jump link
eureka.instance.status-page-url-path=/hello

Knowledge point 3,Eureka Quickly remove failed services during development
In the actual development process , We might be able to restart the service all the time , because Eureka It has its own protection mechanism , Therefore, after the node is offline , Service information will always exist in Eureka in . We can make the removal faster by adding some configurations , Only in the development environment, of course , It is not recommended in production environment .
First of all in our eureka-server Two new configurations are added in , Turn off self-protection and clean-up interval :
eureka.server.enable-self-preservation=false
# Default 60000 millisecond
eureka.server.eviction-interval-timer-in-ms=5000
Then configure the following content in the specific client service :
eureka.client.healthcheck.enabled=true
# Default 30 second
eureka.instance.lease-renewal-interval-in-seconds=5
# Default 90 second
eureka.instance.lease-expiration-duration-in-seconds=5
eureka.client.healthcheck.enabled It's used to turn on the health check , Need to be in pom.xml Introduction in actuator Dependence , The code is as follows .
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
among :
- eureka.instance.lease-renewal-interval-in-seconds Express Eureka Client Send a heartbeat to server The frequency of the end .
- eureka.instance.lease-expiration-duration-in-seconds Express Eureka Server Last received client After my heart beat , Timeout waiting for next heartbeat , If you don't receive the next heartbeat in this time , Then remove the Instance.
added Instance For configuration information, please refer to the configuration class in the source code :org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean.
added Server For configuration information, please refer to the configuration class in the source code :org.springframework.cloud.netflix.eureka.server.EurekaServerConfigBean.
Knowledge point 4,EurekaClient Use
There are two ways
- com.netflix.discovery.EurekaClient
@GetMapping("/test")
public Object serviceUrl() {
return eurekaClient.getInstancesByVipAddress("eureka-provider-app", false);
}
- Spring Cloud Reseal ,org.springframework.cloud.client.discovery.DiscoveryClient
@GetMapping("/test2")
public Object serviceUrl2() {
return discoveryClient.getInstances("eureka-provider-app");
}
边栏推荐
- 【黑马早报】运营23年,易趣网宣布关停;蔚来对大众CEO抛出橄榄枝;华为天才少年曾放弃360万年薪;尹烨回应饶毅炮轰其伪科学...
- [dark horse morning post] eBay announced its shutdown after 23 years of operation; Wei Lai throws an olive branch to Volkswagen CEO; Huawei's talented youth once gave up their annual salary of 3.6 mil
- Knowledge maps are used to recommend system problems (mvin, Ctrl, ckan, Kred, gaeat)
- 【高并发】高并发场景下一种比读写锁更快的锁,看完我彻底折服了!!(建议收藏)
- selenium使用———安装、测试
- [cloud co creation] what is the role of AI in mathematics? What will be the disruptive impact on the mathematical world in the future?
- 那些离开网易的年轻人
- LeetCode第303场周赛(20220724)
- 30 sets of Chinese style ppt/ creative ppt templates
- 【GCN-RS】MCL: Mixed-Centric Loss for Collaborative Filtering (WWW‘22)
猜你喜欢

和特朗普吃了顿饭后写下了这篇文章

Figure neural network for recommending system problems (imp-gcn, lr-gcn)

Innovation and breakthrough! AsiaInfo technology helped a province of China Mobile complete the independent and controllable transformation of its core accounting database

Zero shot image retrieval (zero sample cross modal retrieval)

【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020

【黑马早报】运营23年,易趣网宣布关停;蔚来对大众CEO抛出橄榄枝;华为天才少年曾放弃360万年薪;尹烨回应饶毅炮轰其伪科学...

Word中的空白页,怎么也删不掉?如何操作?
![[RS sampling] a gain tuning dynamic negative sampler for recommendation (WWW 2022)](/img/23/0901da44160ca685d2c694ae9a834b.png)
[RS sampling] a gain tuning dynamic negative sampler for recommendation (WWW 2022)
![[multimodal] transferrec: learning transferable recommendation from texture of modality feedback arXiv '22](/img/02/5f24b4af44f2f9933ce0f031d69a19.png)
[multimodal] transferrec: learning transferable recommendation from texture of modality feedback arXiv '22

Zero-Shot Image Retrieval(零样本跨模态检索)
随机推荐
[dark horse morning post] eBay announced its shutdown after 23 years of operation; Wei Lai throws an olive branch to Volkswagen CEO; Huawei's talented youth once gave up their annual salary of 3.6 mil
【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020
R语言使用wilcox.test函数执行wilcox符号秩检验获取总体中位数(median)的置信区间(默认输出结果包括95%置信水平的置信区间)
Brpc source code analysis (IV) -- bthread mechanism
[GCN multimodal RS] pre training representations of multi modal multi query e-commerce search KDD 2022
The applet image cannot display Base64 pictures. The solution is valid
【高并发】高并发场景下一种比读写锁更快的锁,看完我彻底折服了!!(建议收藏)
Figure neural network for recommending system problems (imp-gcn, lr-gcn)
Hydrogen entrepreneurship competition | Liu Yafang, deputy director of the science and Technology Department of the National Energy Administration: building a high-quality innovation system is the cor
【CTR】《Towards Universal Sequence Representation Learning for Recommender Systems》 (KDD‘22)
【GCN-RS】Learning Explicit User Interest Boundary for Recommendation (WWW‘22)
After having a meal with trump, I wrote this article
【GCN-RS】Region or Global? A Principle for Negative Sampling in Graph-based Recommendation (TKDE‘22)
dirReader.readEntries 兼容性问题 。异常错误DOMException
30 sets of Chinese style ppt/ creative ppt templates
Zero shot image retrieval (zero sample cross modal retrieval)
Go 垃圾回收器指南
【Debias】Model-Agnostic Counterfactual Reasoning for Eliminating Popularity Bias in RS(KDD‘21)
【6篇文章串讲ScalableGNN】围绕WWW 2022 best paper《PaSca》
协程