Eureka Server Discovery Service

Eureka is a REST-based service that is primarily used for locating services for the purpose of load balancing and failover of middle-tier servers. Eureka provides both a discovery server and also support for clients which would be the individual CAS servers themselves in the pool. The server can be configured and deployed to be highly available, with each server replicating state about the registered services to the others.

CAS provides a Eureka-enabled service discovery server that is based on Spring Cloud Netflix and bootstrapped via Spring Cloud.

Installation

The Eureka discovery server is not part of the CAS server and is a standalone web application which can be deployed using the CAS Initializr.

You may also ook for a suitable and relevant ready-made Docker image via docker search eureka.

When deployed the following URLs become available:

URL Description
/ Home page listing service registrations.
/eureka/apps Raw registration metadata.

High Availability Mode

You always want to make sure the discovery server is run in high-availability mode. One option is to ensure each individual Eureka server is peer aware. See this guide to learn how to manage that.

CAS Discovery Service Clients

Each individual CAS server is given the ability to auto-register itself with the discovery server, provided configuration is made available to instruct the CAS server how to locate and connect to the discover server service.

Support is added by including the following dependency in the WAR overlay:

1
2
3
4
5
<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-eureka-client</artifactId>
    <version>${cas.version}</version>
</dependency>
1
implementation "org.apereo.cas:cas-server-support-eureka-client:${project.'cas.version'}"
1
2
3
4
5
6
7
8
9
dependencyManagement {
    imports {
        mavenBom "org.apereo.cas:cas-server-support-bom:${project.'cas.version'}"
    }
}

dependencies {
    implementation "org.apereo.cas:cas-server-support-eureka-client"
}
1
2
3
4
5
6
7
8
9
10
dependencies {
    /*
    The following platform references should be included automatically and are listed here for reference only.
            
    implementation enforcedPlatform("org.apereo.cas:cas-server-support-bom:${project.'cas.version'}")
    implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
    */

    implementation "org.apereo.cas:cas-server-support-eureka-client"
}

The following settings and properties are available from the CAS configuration catalog:

The configuration settings listed below are tagged as Required in the CAS configuration metadata. This flag indicates that the presence of the setting may be needed to activate or affect the behavior of the CAS feature and generally should be reviewed, possibly owned and adjusted. If the setting is assigned a default value, you do not need to strictly put the setting in your copy of the configuration, but should review it nonetheless to make sure it matches your deployment expectations.

The configuration settings listed below are tagged as Optional in the CAS configuration metadata. This flag indicates that the presence of the setting is not immediately necessary in the end-user CAS configuration, because a default value is assigned or the activation of the feature is not conditionally controlled by the setting value. You should only include this field in your configuration if you need to modify the default value.

The configuration settings listed below are tagged as Third Party in the CAS configuration metadata. This flag indicates that the configuration setting is not controlled, owned or managed by the CAS ecosystem, and affects functionality that is offered by a third-party library, such as Spring Boot or Spring Cloud to CAS. For additional info, you might have to visit the third-party source to find more details.

  • eureka.client.allow-redirects=false
  • Indicates whether server can redirect a client request to a backup server/cluster. If set to false, the server will handle the request directly, If set to true, it may send HTTP redirect to the client, with a new server location.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.availability-zones=
  • Gets the list of availability zones (used in AWS data centers) for the region in which this instance resides. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.backup-registry-impl=
  • Gets the name of the implementation which implements BackupRegistry to fetch the registry information as a fall back option for only the first time when the eureka client starts. This may be needed for applications which needs additional resiliency for registry information without which it cannot operate.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.cache-refresh-executor-exponential-back-off-bound=10
  • Cache refresh executor exponential back off related property. It is a maximum multiplier value for retry delay, in case where a sequence of timeouts occurred.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.cache-refresh-executor-thread-pool-size=2
  • The thread pool size for the cacheRefreshExecutor to initialise with.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.client-data-accept=
  • EurekaAccept name for client data accept.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.decoder-name=
  • This is a transient config and once the latest codecs are stable, can be removed (as there will only be one).

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.disable-delta=false
  • Indicates whether the eureka client should disable fetching of delta and should rather resort to getting the full registry information. Note that the delta fetches can reduce the traffic tremendously, because the rate of change with the eureka server is normally much lower than the rate of fetches. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.dollar-replacement=_-
  • Get a replacement string for Dollar sign $ during serializing/deserializing information in eureka server.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.enabled=true
  • Flag to indicate that the Eureka client is enabled.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.encoder-name=
  • This is a transient config and once the latest codecs are stable, can be removed (as there will only be one).

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.escape-char-replacement=__
  • Get a replacement string for underscore sign _ during serializing/ deserializing information in eureka server.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-connection-idle-timeout-seconds=30
  • Indicates how much time (in seconds) that the HTTP connections to eureka server can stay idle before it can be closed. In the AWS environment, it is recommended that the values is 30 seconds or less, since the firewall cleans up the connection information after a few mins leaving the connection hanging in limbo.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-server-connect-timeout-seconds=5
  • Indicates how long to wait (in seconds) before a connection to eureka server needs to timeout. Note that the connections in the client are pooled by org.apache.http.client.HttpClient and this setting affects the actual connection creation and also the wait time to get the connection from the pool.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-server-d-n-s-name=
  • Gets the DNS name to be queried to get the list of eureka servers.This information is not required if the contract returns the service urls by implementing serviceUrls. The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-server-port=
  • Gets the port to be used to construct the service url to contact eureka server when the list of eureka servers come from the DNS.This information is not required if the contract returns the service urls eurekaServerServiceUrls(String). The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-server-read-timeout-seconds=8
  • Indicates how long to wait (in seconds) before a read from eureka server needs to timeout.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-server-total-connections=200
  • Gets the total number of connections that is allowed from eureka client to all eureka servers.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-server-total-connections-per-host=50
  • Gets the total number of connections that is allowed from eureka client to a eureka server host.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-server-u-r-l-context=
  • Gets the URL context to be used to construct the service url to contact eureka server when the list of eureka servers come from the DNS. This information is not required if the contract returns the service urls from eurekaServerServiceUrls. The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the eureka client expects the DNS to configured a certain way so that it can fetch changing eureka servers dynamically. The changes are effective at runtime.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.eureka-service-url-poll-interval-seconds=0
  • Indicates how often(in seconds) to poll for changes to eureka server information. Eureka servers could be added or removed and this setting controls how soon the eureka clients should know about it.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.fetch-registry=true
  • Indicates whether this client should fetch eureka registry information from eureka server.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.fetch-remote-regions-registry=
  • Comma separated list of regions for which the eureka registry information will be fetched. It is mandatory to define the availability zones for each of these regions as returned by availabilityZones. Failing to do so, will result in failure of discovery client startup.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.filter-only-up-instances=true
  • Indicates whether to get the applications after filtering the applications for instances with only InstanceStatus UP states.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.g-zip-content=true
  • Indicates whether the content fetched from eureka server has to be compressed whenever it is supported by the server. The registry information from the eureka server is compressed for optimum network traffic.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.healthcheck.enabled=true
  • Enables the Eureka health check handler.

    How can I configure this property?

  • eureka.client.heartbeat-executor-exponential-back-off-bound=10
  • Heartbeat executor exponential back off related property. It is a maximum multiplier value for retry delay, in case where a sequence of timeouts occurred.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.heartbeat-executor-thread-pool-size=2
  • The thread pool size for the heartbeatExecutor to initialise with.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.initial-instance-info-replication-interval-seconds=40
  • Indicates how long initially (in seconds) to replicate instance info to the eureka server.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.instance-info-replication-interval-seconds=30
  • Indicates how often(in seconds) to replicate instance changes to be replicated to the eureka server.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.log-delta-diff=false
  • Indicates whether to log differences between the eureka server and the eureka client in terms of registry information. Eureka client tries to retrieve only delta changes from eureka server to minimize network traffic. After receiving the deltas, eureka client reconciles the information from the server to verify it has not missed out some information. Reconciliation failures could happen when the client has had network issues communicating to server.If the reconciliation fails, eureka client gets the full registry information. While getting the full registry information, the eureka client can log the differences between the client and the server and this setting controls that. The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSecondsr

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.on-demand-update-status-change=true
  • If set to true, local status updates via ApplicationInfoManager will trigger on-demand (but rate limited) register/updates to remote eureka servers.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.order=0
  • Order of the discovery client used by `CompositeDiscoveryClient` for sorting available clients.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.prefer-same-zone-eureka=true
  • Indicates whether or not this instance should try to use the eureka server in the same zone for latency and/or other reason. Ideally eureka clients are configured to talk to servers in the same zone The changes are effective at runtime at the next registry fetch cycle as specified by registryFetchIntervalSeconds

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.property-resolver=
  • org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.proxy-host=
  • Gets the proxy host to eureka server if any.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.proxy-password=
  • Gets the proxy password if any.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.proxy-port=
  • Gets the proxy port to eureka server if any.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.proxy-user-name=
  • Gets the proxy user name if any.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.refresh.enable=true
  • Determines whether the EurekaClient instance can be refreshed or not(If disabled none of the Eureka client properties will be refreshable).

    How can I configure this property?

  • eureka.client.region=us-east-1
  • Gets the region (used in AWS datacenters) where this instance resides.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.register-with-eureka=true
  • Indicates whether or not this instance should register its information with eureka server for discovery by others. In some cases, you do not want your instances to be discovered whereas you just want do discover other instances.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.registry-fetch-interval-seconds=30
  • Indicates how often(in seconds) to fetch the registry information from the eureka server.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.registry-refresh-single-vip-address=
  • Indicates whether the client is only interested in the registry information for a single VIP.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.service-url=
  • Map of availability zone to list of fully qualified URLs to communicate with eureka server. Each value can be a single URL or a comma separated list of alternative locations. Typically the eureka server URLs carry protocol,host,port,context and version information if any. Example: https://ec2-256-156-243-129.compute-1.amazonaws.com:7001/eureka/ The changes are effective at runtime at the next service url refresh cycle as specified by eurekaServiceUrlPollIntervalSeconds.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.should-enforce-registration-at-init=false
  • Indicates whether the client should enforce registration during initialization. Defaults to false.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.should-unregister-on-shutdown=true
  • Indicates whether the client should explicitly unregister itself from the remote server on client shutdown.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.tls.enabled=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.tls.key-password=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.tls.key-store=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.tls.key-store-password=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.tls.key-store-type=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.tls.trust-store=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.tls.trust-store-password=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.tls.trust-store-type=
  • org.springframework.cloud.configuration.TlsProperties.

    How can I configure this property?

  • eureka.client.use-dns-for-fetching-service-urls=false
  • Indicates whether the eureka client should use the DNS mechanism to fetch a list of eureka servers to talk to. When the DNS name is updated to have additional servers, that information is used immediately after the eureka client polls for that information as specified in eurekaServiceUrlPollIntervalSeconds. Alternatively, the service urls can be returned serviceUrls, but the users should implement their own mechanism to return the updated list in case of changes. The changes are effective at runtime.

    org.springframework.cloud.netflix.eureka.EurekaClientConfigBean.

    How can I configure this property?

  • eureka.client.webclient.enabled=false
  • Enables the use of WebClient for Eureka HTTP Client.

    How can I configure this property?

  • spring.cloud.config.discovery.enabled=false
  • Flag to indicate that config server discovery is enabled (config server URL will be looked up via discovery).

    org.springframework.cloud.config.client.ConfigClientProperties$Discovery.

    How can I configure this property?

  • spring.cloud.config.discovery.service-id=configserver
  • Service id to locate config server.

    org.springframework.cloud.config.client.ConfigClientProperties$Discovery.

    How can I configure this property?

    Configuration Metadata

    The collection of configuration properties listed in this section are automatically generated from the CAS source and components that contain the actual field definitions, types, descriptions, modules, etc. This metadata may not always be 100% accurate, or could be lacking details and sufficient explanations.

    Be Selective

    This section is meant as a guide only. Do NOT copy/paste the entire collection of settings into your CAS configuration; rather pick only the properties that you need. Do NOT enable settings unless you are certain of their purpose and do NOT copy settings into your configuration only to keep them as reference. All these ideas lead to upgrade headaches, maintenance nightmares and premature aging.

    YAGNI

    Note that for nearly ALL use cases, declaring and configuring properties listed here is sufficient. You should NOT have to explicitly massage a CAS XML/Java/etc configuration file to design an authentication handler, create attribute release policies, etc. CAS at runtime will auto-configure all required changes for you. If you are unsure about the meaning of a given CAS setting, do NOT turn it on without hesitation. Review the codebase or better yet, ask questions to clarify the intended behavior.

    Naming Convention

    Property names can be specified in very relaxed terms. For instance cas.someProperty, cas.some-property, cas.some_property are all valid names. While all forms are accepted by CAS, there are certain components (in CAS and other frameworks used) whose activation at runtime is conditional on a property value, where this property is required to have been specified in CAS configuration using kebab case. This is both true for properties that are owned by CAS as well as those that might be presented to the system via an external library or framework such as Spring Boot, etc.

    When possible, properties should be stored in lower-case kebab format, such as cas.property-name=value. The only possible exception to this rule is when naming actuator endpoints; The name of the actuator endpoints (i.e. ssoSessions) MUST remain in camelCase mode.

    Settings and properties that are controlled by the CAS platform directly always begin with the prefix cas. All other settings are controlled and provided to CAS via other underlying frameworks and may have their own schemas and syntax. BE CAREFUL with the distinction. Unrecognized properties are rejected by CAS and/or frameworks upon which CAS depends. This means if you somehow misspell a property definition or fail to adhere to the dot-notation syntax and such, your setting is entirely refused by CAS and likely the feature it controls will never be activated in the way you intend.

    Validation

    Configuration properties are automatically validated on CAS startup to report issues with configuration binding, specially if defined CAS settings cannot be recognized or validated by the configuration schema. The validation process is on by default and can be skipped on startup using a special system property SKIP_CONFIG_VALIDATION that should be set to true. Additional validation processes are also handled via Configuration Metadata and property migrations applied automatically on startup by Spring Boot and family.

    Indexed Settings

    CAS settings able to accept multiple values are typically documented with an index, such as cas.some.setting[0]=value. The index [0] is meant to be incremented by the adopter to allow for distinct multiple configuration blocks.

    Authentication

    Support for HTTP basic authentication will be automatically added if one of Eureka server URLs in the configuration has credentials embedded in it (curl style, like http://user:password@localhost:8761/eureka).

    Troubleshooting

    To enable additional logging, configure the log4j configuration file to add the following levels:

    1
    2
    3
    4
    5
    6
    7
    8
    
    <Logger name="org.springframework.cloud" level="debug" additivity="false">
      <AppenderRef ref="casConsole"/>
      <AppenderRef ref="casFile"/>
    </Logger>
    <Logger name="com.netflix" level="debug" additivity="false">
        <AppenderRef ref="casConsole"/>
        <AppenderRef ref="casFile"/>
    </Logger>