In this section we will focus on the introduction Eureka Self protection mode on and off and custom Eureka Of InstanceID Configuration of .
Turn off self-protection
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 .
If in Eureka Of Web See the figure on the console 1 What is shown , To prove it Eureka Server It's in protected mode .
Self protection mode can be turned off by the following configuration , This configuration is in eureka-server in ：
Customize Eureka Of InstanceID
When the client registers , Service Instance ID The format of the default value for is as follows ：
Which translates as “ Host name ： The service name ： Service port ”. When we're in Eureka Of Web When the console looks at the service registration information , It's a format like this ：
A lot of times we want to put IP Displayed in the above format , here , Just replace the host name with IP That's all right. , Or adjust the order . It can be changed to the following , use “ The service name ： Where the service is IP： Service port ” To define ：
What we see after the definition is eureka-client-user-service：192.168.31.245：8081, You can tell which service it is at a glance , On which machine , What is the port .
We can also click on the service Instance ID To jump , At this time, the name of the display becomes IP, But the jump link is still the host name .
So we need to add a configuration to make the jump link look like we want , Use IP To register , Pictured 2 Shown ：
Custom instance jump link
Just now, we have realized using IP To register , When you click Instance ID When doing a jump , You can use it IP Jump around , The default address of the jump is IP+Port/info. We can customize the address of this jump ：
The effect is as shown in the picture 3 Shown .