Spring Cloud Eureka using IP addresses for service registration

Source: Internet
Author: User

By default, Eureka uses hostname for service registration and display of service information, so how do we configure it if we use an IP address? The answer is eureka.instance.prefer-ip-address=true .

Purpose: We are configured eureka.instance.prefer-ip-address=true to ensure that Eureka Server hostname use IP addresses when registering with each other while using IP addresses as eureka.client.service-url.defaultZone configuration values.

Eureka Server Cluster Configuration:

Debug:TrueSpring:  Application:    Name:Eureka-serverLogging:  Level :    Com.netflix.eureka: ' off '    Com.netflix.discovery: ' off '---Spring:  Profiles:Manager1Server:  Port:8100Eureka:  instance:    prefer-ip-address:True#以IP地址注册到服务中心, registering each other with an IP address    #ip-address:192.168.1.1 #强制指定IP地址, the default is to get the IP address of the machine  Client:    Service-url:      Defaultzone:http://192.168.1.2:8100/eureka/,http://192.168.1.3:8100/eureka/---Spring:  Profiles:Manager2Server:  Port:8100Eureka:  instance:    prefer-ip-address:TrueClient:    Service-url:      Defaultzone:http://192.168.1.1:8100/eureka/,http://192.168.1.3:8100/eureka/---Spring:  Profiles:Manager3Server:  Port:8100Eureka:  instance:    prefer-ip-address:TrueClient:    Service-url:      Defaultzone:http://192.168.1.1:8100/eureka/,http://192.168.1.2:8100/eureka/

Eureka Client Configuration:

debug: truespring:  application:    name: eureka-clientserver:  port: 8110eureka:  instance:    prefer-ip-address:#以IP地址注册到服务中心    #instance-id: http://192.168.1.4:8110 #服务中心的信息显示(如果IP地址不显示的话,进行配置)  client:    service-url:      defaultZone: http://192.168.1.1:8100/eureka/,http://192.168.1.2:8100/eureka/,http://192.168.1.3:8100/eureka/

Implementation effect (for reference only, does not contain Eureka Server Mutual registration IP addresses):

It is important to note that the above tests are not tested and are theoretically feasible.

Resources:

    • Eureka Service Registration Process detailed IPAddress (Detailed eureka.instance.prefer-ip-address = True and eureka.instance.prefer-ip-address)
    • Eureka Service Registration List Display IP problem research
    • Can I Force Eureka registrations to use an IP address instead of a hostname?
    • Spring-cloud-netflix

Spring Cloud Eureka using IP addresses for service registration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.