Integrated Spring Cloud Cloud service Architecture-Eureka Foundation (bottom)

Source: Internet
Author: User

Attention
If your application runs behind a proxy server and SSL terminates the service in the proxy (for example, if you are running on cloud foundry or other platforms as a service), you need to ensure that the agent "forward" header is intercepted and processed by the application. The embedded Tomcat container in the Spring boot application automatically performs an explicit configuration of the "x-forwarded-\ *" header. One of the signs of your mistake is that the link presented by your application itself is wrong (the wrong host, Port, or protocol).
Eureka Health Check-up
By default, Eureka uses the client heartbeat to determine whether the client is started. Unless otherwise specified, the discovery client will not propagate the current health check state of the application based on the spring boot executor. This means that after successful registration Eureka will always announce that the application is in the "Up" state. You can change this behavior by enabling Eureka Health checks to propagate application state to Eureka. Therefore, each other application will not send traffic to the application in a state other than "up".

APPLICATION.YML
Eureka:
  Client:
    Healthcheck:
      Enabled:true
Warning
Eureka.client.healthcheck.enabled=true can only be set in Application.yml. Setting the value in Bootstrap.yml will result in undesirable side effects, such as registering in a Eureka with a unknown status.
If you need more control over your health checks, you may want to consider implementing your own com.netflix.appinfo.HealthCheckHandler.

eureka instance and client metadata
is worth taking a moment to understand how Eureka metadata works so that you can use it on the platform. There are standard metadata such as host name, IP address, port number, status page, and health check. These are published in the service registry and are used by customers to contact the service directly. Additional metadata can be added to the instance registration in Eureka.instance.metadataMap, and this is accessible in remote clients, but generally does not change the behavior of the client unless it is aware of the meaning of the metadata. Several special cases are described below, where spring cloud has already specified the meaning of the metadata map.

Use Eureka on Cloudfoundry
Cloudfoundry has a global router, so all instances of the same application have the same host name (as in other PAAs solutions with similar schemas). This is not necessarily an obstacle to using Eureka, but if you use a router (which is recommended, or even mandatory, depending on how your platform is set up), you need to explicitly set the hostname and port number (secure or non-secure) so that they can use the router. You may also want to use instance metadata so that you can differentiate between instances on the client (for example, in a custom load balancer). By default, Eureka.instance.instanceId is vcap.application.instance_id. For example:

Application.yml
Eureka
Instance
Hostname: ${vcap.application.uris[0]}
Nonsecureport:80

Service Discovery: Eureka Server
How to include a Eureka server
To include Eureka servers in your project, use the initiator of group Org.springframework.cloud and artifact ID spring-cloud-starter-eureka-server. For more information about using the current Spring Cloud Publishing list settings to build your system, see the Spring Cloud project page.

How to run the Eureka server
Example Eureka Server;

@SpringBootApplication
@EnableEurekaServer
public class Application {

public static void Main (string[] args) {
New Springapplicationbuilder (Application.class). Web (True). Run (args);
}

}

I will not talk about the other, there is a lot of information about the registration center, you can check the relevant data.

From now on, I will be documenting the process and essence of the recent development of the spring cloud micro-service cloud architecture to help more friends who are interested in developing the Spring cloud framework to explore the process of building the spring cloud architecture and how to use it in enterprise projects. Source of information source


Integrated Spring Cloud Cloud service Architecture-Eureka Foundation (bottom)

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.