Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Eureka self-protection mode and InstanceID configuration

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

In this issue, Xiaobian will bring you the configuration of Eureka self-protection mode and InstanceID. The article is rich in content and analyzed and described from a professional perspective. After reading this article, I hope you can gain something.

Turn off self-protection

Protected mode is primarily used when there is a network partitioning scenario between a set of clients and Eureka Server. Once in protected mode, Eureka Server attempts to protect information in its service registry and no longer deletes data from the service registry. When the network fails to recover, the Eureka Server node automatically exits protected mode.

If you see something like Figure 1 in Eureka's Web console, you're in protected mode.

Self-protection mode can be turned off by configuring eureka-server as follows:

eureka.server.enableSelfPreservation=false Custom InstanceID of Eureka

When the client registers, the default value of the Instance ID of the service has the following format:

${spring.cloud.client.hostname}:${spring.application.name}:${spring.application. instance_id:${server.port}}

Translated as "hostname: service name: service port." When we view service registration information in Eureka's Web console, it looks like this:

user-PC:eureka-client-user-service:8081

Many times we want to display IP in the above format, in this case, just replace the hostname with IP, or adjust the order. It can be changed to the following, defined in the format of "service name: IP where the service is located: service port":

eureka.instance.instance-id=${spring.application.name}:${spring.cloud.client.ip-address}:${server.port}

After definition, we see eureka-client-user-service: 192.168.31.245: 8081, which service, on which machine, and on what port.

We can also click on the Instance ID of the service to jump. At this time, although the name displayed becomes IP, the link to jump is still the host name.

So you need to add a configuration to make the jump link look like we want, using IP to register, as shown in Figure 2:

Custom Instance Jump Links

Just now we have realized registration with IP through configuration. When clicking Instance ID to jump, you can jump with IP. The default address of jump is IP+Port/info. We can customize the address of this jump:

eureka.instance.status-page-url=c.biancheng.net

The effect is shown in Figure 3.

The above is the configuration of Eureka self-protection mode and InstanceID shared by Xiaobian. If there is a similar doubt, please refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report