Skip to content

Toro Cloud Dev Center


Eureka

Martini can be used in a Eureka managed environment. Please note that Eureka only allows instance-level service registration, meaning only entire Martini instances can be registered1. Also note that Eureka doesn't support leader election.

Martini configuration

The bare minimum to have Martini work with Eureka is to configure the eureka.client.eurekaServerServiceUrls.default property. If this property is not configured, Martini will not use any Eureka-specific functionality. For example:

1
eureka.client.eurekaServerServiceUrls.default=http://my-eureka-server.com:8761/eureka

The default part of the property name should equal the value of your configured eureka.zone property, which by default is default. If your eureka.zone property is configured with another value, then the eureka.client.eurekaServerServiceUrls needs to be updated also. For example:

1
2
eureka.zone=hello-world
eureka.client.eurekaServerServiceUrls.hello-world=http://hello-world-cureka-server.com:8761/eureka

Got multiple Eureka servers?

The Eureka client supports connecting to multiple servers, simply add the extra URLs to the same eureka.client.eurekaServerServiceUrls property, separated by a comma (,).

Advanced configuration

Eureka contains many different options on configuring the client, so in order to make it easy to configure Martini with Eureka, all options can be configured in exactly the same way, by following a few simple rules.

The Eureka client is primarily configured with three classes and interfaces, each of which has an implementation in Martini. These three are:

Class/Interface Properties prefix Description
com.netflix.discovery.EurekaClientConfig eureka.client. Configuration information required by the Eureka client to register Martini with Eureka server.
com.netflix.appinfo.AbstractInstanceConfig eureka.instance. Configuration information required by Martini to register with Eureka server.
com.netflix.discovery.shared.transport.EurekaTransportConfig eureka.transport. Configuration information relevant to the transport layer.

In order to configure most advanced properties, add an application property to Martini, with the properties prefix from the respective class/interface above (but without the get prefix in the method name of the property if it has one), and with a lower-case first letter. For example, to configure the [com.netflix.discovery.EurekaClientConfig#shouldGZipContent][client-shouldGZipContent] property to false, you would add:

1
eureka.client.shouldGZipContent=false

Alternatively, to configure [com.netflix.appinfo.EurekaInstanceConfig#getAppname][instance-appname] to my-martini-app, you would add:

1
eureka.instance.appname=my-martini-app

Below are tables that outline the property names, (linked to their respective javadoc), and the default Martini values.

Client configuration

Property Default value
[eureka.client.allowRedirects][client-allowRedirects] false
[eureka.client.backupRegistryImpl][client-backupRegistryImpl] null
[eureka.client.cacheRefreshExecutorExponentialBackOffBound][client-cacheRefreshExecutorExponentialBackOffBound] 10
[eureka.client.cacheRefreshExecutorThreadPoolSize][client-cacheRefreshExecutorThreadPoolSize] 5
[eureka.client.clientDataAccept][client-clientDataAccept] null
[eureka.client.decoderName][client-decoderName] null
[eureka.client.disableDelta][client-disableDelta] false
[eureka.client.dollarReplacement][client-dollarReplacement] _-
[eureka.client.encoderName][client-encoderName] null
[eureka.client.escapeCharReplacement][client-escapeCharReplacement] __
[eureka.client.eurekaConnectionIdleTimeoutSeconds][client-eurekaConnectionIdleTimeoutSeconds] 30
[eureka.client.eurekaServerConnectTimeoutSeconds][client-eurekaServerConnectTimeoutSeconds] 5
[eureka.client.eurekaServerDNSName][client-eurekaServerDNSName] null
[eureka.client.eurekaServerPort][client-eurekaServerPort] null
[eureka.client.eurekaServerReadTimeoutSeconds][client-eurekaServerReadTimeoutSeconds] 8
[eureka.client.eurekaServerTotalConnectionsPerHost][client-eurekaServerTotalConnectionsPerHost] 50
[eureka.client.eurekaServerTotalConnections][client-eurekaServerTotalConnections] 200
[eureka.client.eurekaServerURLContext][client-eurekaServerURLContext] null
[eureka.client.eurekaServiceUrlPollIntervalSeconds][client-eurekaServiceUrlPollIntervalSeconds] 300
[eureka.client.fetchRegistryForRemoteRegions][client-fetchRegistryForRemoteRegions] null
[eureka.client.heartbeatExecutorExponentialBackOffBound][client-heartbeatExecutorExponentialBackOffBound] 10
[eureka.client.heartbeatExecutorThreadPoolSize][client-heartbeatExecutorThreadPoolSize] 5
[eureka.client.initialInstanceInfoReplicationIntervalSeconds][client-initialInstanceInfoReplicationIntervalSeconds] 40
[eureka.client.instanceInfoReplicationIntervalSeconds][client-instanceInfoReplicationIntervalSeconds] 30
[eureka.client.logDeltaDiff][client-logDeltaDiff] false
[eureka.client.preferSameZoneEureka][client-preferSameZoneEureka] true
[eureka.client.proxyHost][client-proxyHost] null
[eureka.client.proxyPassword][client-proxyPassword] null
[eureka.client.proxyPort][client-proxyPort] null
[eureka.client.proxyUserName][client-proxyUserName] null
[eureka.client.region][client-region] us-east-1
[eureka.client.registryFetchIntervalSeconds][client-registryFetchIntervalSeconds] 30
[eureka.client.registryRefreshSingleVipAddress][client-registryRefreshSingleVipAddress] null
[eureka.client.shouldEnforceFetchRegistryAtInit][client-shouldEnforceFetchRegistryAtInit] true
[eureka.client.shouldEnforceRegistrationAtInit][client-shouldEnforceRegistrationAtInit] false
[eureka.client.shouldFetchRegistry][client-shouldFetchRegistry] true
[eureka.client.shouldFilterOnlyUpInstances][client-shouldFilterOnlyUpInstances] true
[eureka.client.shouldGZipContent][client-shouldGZipContent] true
[eureka.client.shouldOnDemandUpdateStatusChange][client-shouldOnDemandUpdateStatusChange] true
[eureka.client.shouldUnregisterOnShutdown][client-shouldUnregisterOnShutdown] true
[eureka.client.useDnsForFetchingServiceUrls][client-useDnsForFetchingServiceUrls] false

Instance configuration

Property Default value
[eureka.instance.appGroupName][instance-appGroupName] toro-martini
[eureka.instance.appname][instance-appname] toro-martini
[eureka.instance.healthCheckUrlPath][instance-healthCheckUrlPath] /statistics/status
[eureka.instance.healthCheckUrl][instance-healthCheckUrl] /statistics/status
[eureka.instance.homePageUrlPath][instance-homePageUrlPath] /
[eureka.instance.homePageUrl][instance-homePageUrl] /
[eureka.instance.instanceId][instance-instanceId] null
[eureka.instance.namespace][instance-namespace] toro
[eureka.instance.secureHealthCheckUrl][instance-secureHealthCheckUrl] /statistics/status
[eureka.instance.statusPageUrlPath][instance-statusPageUrlPath] /statistics/status
[eureka.instance.statusPageUrl][instance-statusPageUrl] /statistics/status

Transport configuration

Property Default value
[eureka.transport.applicationsResolverDataStalenessThresholdSeconds][transport-applicationsResolverDataStalenessThresholdSeconds] 300
[eureka.transport.applicationsResolverUseIp][transport-applicationsResolverUseIp] false
[eureka.transport.asyncExecutorThreadPoolSize][transport-asyncExecutorThreadPoolSize] 5
[eureka.transport.asyncResolverRefreshIntervalMs][transport-asyncResolverRefreshIntervalMs] 300000
[eureka.transport.asyncResolverWarmUpTimeoutMs][transport-asyncResolverWarmUpTimeoutMs] 5000
[eureka.transport.bootstrapResolverStrategy][transport-bootstrapResolverStrategy] null
[eureka.transport.readClusterVip][transport-readClusterVip] null
[eureka.transport.retryableClientQuarantineRefreshPercentage][transport-retryableClientQuarantineRefreshPercentage] 0.66
[eureka.transport.sessionedClientReconnectIntervalSeconds][transport-sessionedClientReconnectIntervalSeconds] 0
[eureka.transport.useBootstrapResolverForQuery][transport-useBootstrapResolverForQuery] true
[eureka.transport.writeClusterVip][transport-writeClusterVip] null

  1. The name of the instance is configured with the eureka.instance.appname property.