SpringCloud之Eureka详细的配置

介绍

SpringCloud是一个完整的微服务治理框架,包括服务发现和注册,服务网关,熔断,限流,负载均衡和链路跟踪等组件。

SpringCloud-Eureka主要提供服务注册和发现功能。本文提供了该组件配置的全面说明。

术语和概念

  • Eureka服务端:负责服务注册、发现并管理每项服务的中心
  • Eureka实例:服务(如订单系统)部署多个服务器,每个服务器上提供的服务都是实例
  • Eureka服务:指提供特定服务功能的服务,例如:订单系统,同一服务可以提供多个实例;
  • Eureka客户端:主要向服务中心注册自己成为服务。但它既可以是服务提供者,也可以是消费者。它与Eureka实例感觉相似,但实际上意义不同。

配置说明

Eureka服务器配置

  1.  
    ################server Configuration associated with client####################33
  2.  
    # Open self-protection mode. No matter what the situation, the server will maintain a certain number of services. Avoid network problems between client and server, and a large number of services are cleared.
  3.  
    eureka.server.enable-self-preservation=true
  4.  
    # Enable the timed task to clear invalid services. Default 1 minute
  5.  
    eureka.server.eviction-interval-timer-in-ms= 60000
  6.  
    # How long, clear expired delta data
  7.  
    eureka.server.delta-retention-timer-interval-in-ms=0
  8.  
    # , is it also available to the client?
  9.  
    eureka.server.disable-delta=false
  10.  
    #eureka Whether the server records the identity of the client header
  11.  
    eureka.server.log-identity-headers=true
  12.  
    #Request frequency limiter
  13.  
    eureka.server.rate-limiter-burst-size=10
  14.  
    # Whether to enable the request frequency limiter
  15.  
    eureka.server.rate-limiter-enabled=false
  16.  
    #Request frequency average
  17.  
    eureka.server.rate-limiter-full-fetch-average-rate=100
  18.  
    # Whether to limit the frequency request to the standard client. If false, only limit non-standard clients
  19.  
    eureka.server.rate-limiter-throttle-standard-clients=false
  20.  
    #Register service, average value of request frequency for pulling service list data
  21.  
    eureka.server.rate-limiter-registry-fetch-average-rate=500
  22.  
    #Set the trusted client list
  23.  
    eureka.server.rate-limiter-privileged-clients=
  24.  
    # In the set time range class, the percentage expected to be renewed with the client.
  25.  
    eureka.server.renewal-percent-threshold=0.85
  26.  
    #How long to update the renewal threshold
  27.  
    eureka.server.renewal-threshold-update-interval-ms=0
  28.  
    #How long does it take for cached registration data to expire?
  29.  
    eureka.server.response-cache-auto-expiration-in-seconds=180
  30.  
    #How long to update the service registration data in the cache
  31.  
    eureka.server.response-cache-update-interval-ms=0
  32.  
    #Cache the time of the incremental data so that no information is lost when searching
  33.  
    eureka.server.retention-time-in-m-s-in-delta-queue=0
  34.  
    #When the timestamps are inconsistent, whether to synchronize
  35.  
    eureka.server.sync-when-timestamp-differs=true
  36.  
    # Whether to adopt a read-only cache policy, the read-only policy does not expire for cached data.
  37.  
    eureka.server.use-read-only-response-cache=true
  38.  
     
  39.  
    ################server Customized Implementation Configuration####################33
  40.  
    #json's implementation class name for conversion
  41.  
    eureka.server.json-codec-name=
  42.  
    #PropertyResolver
  43.  
    eureka.server.property-resolver=
  44.  
    #eureka server xml codec implementation name
  45.  
    eureka.server.xml-codec-name=
  46.  
     
  47.  
    ################Association between server node and node####################33
  48.  
    # replication data is in the request, always compressed
  49.  
    eureka.server.enable-replicated-request-compression=false
  50.  
    # Indicates whether replication between cluster nodes should be batched to improve network efficiency.
  51.  
    eureka.server.batch-replication=false
  52.  
    #Allow the maximum number of replication events that are backed up to the backup pool. This backup pool is responsible for other events except status updates. This value can be set according to memory size, timeout and replication traffic.
  53.  
    eureka.server.max-elements-in-peer-replication-pool=10000
  54.  
    #Allow the maximum number of replication events that are backed up to the stateful backup pool
  55.  
    eureka.server.max-elements-in-status-replication-pool=10000
  56.  
    #Multiple service centers synchronize the maximum idle time of information threads with each other
  57.  
    eureka.server.max-idle-thread-age-in-minutes-for-peer-replication=15
  58.  
    #Status synchronization thread maximum idle time
  59.  
    eureka.server.max-idle-thread-in-minutes-age-for-status-replication=15
  60.  
    #Service registry each instance of the maximum number of threads to copy data to each other
  61.  
    eureka.server.max-threads-for-peer-replication=20
  62.  
    #Service registry each instance of the maximum number of threads copying state data
  63.  
    eureka.server.max-threads-for-status-replication=1
  64.  
    Communication time between #instance and data replication
  65.  
    eureka.server.max-time-for-replication=30000
  66.  
    # The minimum number of normal peer-to-peer services. -1 indicates that the service center is a single node.
  67.  
    eureka.server.min-available-instances-for-peer-replication=-1
  68.  
    The minimum number of threads opened between #instance and mutual replication
  69.  
    eureka.server.min-threads-for-peer-replication=5
  70.  
    Between #instance for state replication, the minimum number of threads opened
  71.  
    eureka.server.min-threads-for-status-replication=1
  72.  
    Number of times that can be retried when copying data between #instance
  73.  
    eureka.server.number-of-replication-retries=5
  74.  
    #eureka How often to update data between nodes. The default is 10 minutes.
  75.  
    eureka.server.peer-eureka-nodes-update-interval-ms=600000
  76.  
    #eureka The time interval between service status updates.
  77.  
    eureka.server.peer-eureka-status-refresh-time-interval-ms=0
  78.  
    #eureka Peer-to-peer connection timeout
  79.  
    eureka.server.peer-node-connect-timeout-ms=200
  80.  
    #eureka idle time after peer node connection
  81.  
    eureka.server.peer-node-connection-idle-timeout-seconds=30
  82.  
    #Read data connection timeout between nodes
  83.  
    eureka.server.peer-node-read-timeout-ms=200
  84.  
    #eureka server Total number of connections between nodes
  85.  
    eureka.server.peer-node-total-connections=1000
  86.  
    #eureka server Maximum number of single machines connected between nodes
  87.  
    eureka.server.peer-node-total-connections-per-host=10
  88.  
    #The number of times eureka tried to obtain registration information when the service node was started
  89.  
    eureka.server.registry-sync-retries=
  90.  
    # When eureka tries to obtain registration information multiple times when the service node starts up
  91.  
    eureka.server.registry-sync-retry-wait-ms=
  92.  
    # When the eureka server is started, you cannot wait for the instance registration information from the peer node. How long should it wait?
  93.  
    eureka.server.wait-time-in-ms-when-sync-empty=0
  94.  
     
  95.  
    ################server Configuration associated with remote####################33
  96.  
    # , is it also provided to the remote region?
  97.  
    eureka.server.disable-delta-for-remote-regions=false
  98.  
    #Old behavior of the application that is rolled back to the remote zone (if configured) If there is no instance of the application in the local zone, it will be disabled.
  99.  
    eureka.server.disable-transparent-fallback-to-other-region=false
  100.  
    # Indicates whether the content obtained from the Eureka server must be compressed for the remote zone if the server supports it.
  101.  
    eureka.server.g-zip-content-from-remote-region=true
  102.  
    #Connection eureka remote note connection timeout
  103.  
    eureka.server.remote-region-connect-timeout-ms=1000
  104.  
    #remote region Application whitelist
  105.  
    eureka.server.remote-region-app-whitelist.
  106.  
    #Connect eureka remote note connection idle time
  107.  
    eureka.server.remote-region-connection-idle-timeout-seconds=30
  108.  
    #Executing remote region The request thread pool size for obtaining registration information
  109.  
    eureka.server.remote-region-fetch-thread-pool-size=20
  110.  
    #remote region Timeout from reading data from peer eureka
  111.  
    eureka.server.remote-region-read-timeout-ms=1000
  112.  
    #Time interval for obtaining registration information from remote region
  113.  
    eureka.server.remote-region-registry-fetch-interval=30
  114.  
    #remote region The total number of connections connecting eureka nodes
  115.  
    eureka.server.remote-region-total-connections=1000
  116.  
    #remote region The number of stand-alone connections connecting eureka nodes
  117.  
    eureka.server.remote-region-total-connections-per-host=50
  118.  
    #remote region fetches the storage file of the registration information, and this reliable storage file needs a fully qualified name to specify
  119.  
    eureka.server.remote-region-trust-store=
  120.  
    #remote region Password of the stored file
  121.  
    eureka.server.remote-region-trust-store-password=
  122.  
    #remote region url. separated by multiple commas
  123.  
    eureka.server.remote-region-urls=
  124.  
    #remote region url. separated by multiple commas
  125.  
    eureka.server.remote-region-urls-with-name.
  126.  
     
  127.  
    ################server Configuration associated with ASG/AWS/EIP/route52################### #33
  128.  
    #Cache the expiration time of ASG information.
  129.  
    eureka.server.a-s-g-cache-expiry-timeout-ms=0
  130.  
    #Query the timeout time of ASG information.
  131.  
    eureka.server.a-s-g-query-timeout-ms=300
  132.  
    #Service update ASG information frequency
  133.  
    eureka.server.a-s-g-update-interval-ms=0
  134.  
    #AWSAccess ID
  135.  
    eureka.server.a-w-s-access-id=
  136.  
    #AWSSecurity Key
  137.  
    eureka.server.a-w-s-secret-key=
  138.  
    #AWSbinding strategy
  139.  
    eureka.server.binding-strategy=eip
  140.  
    #Use the name of the role that automatically extends the grouping from a third-party AWS account description.
  141.  
    eureka.server.list-auto-scaling-groups-role-name=
  142.  
    #Whether should establish a connection guide
  143.  
    eureka.server.prime-aws-replica-connections=true
  144.  
    #Number of times the server tries to bind candidate EIPs
  145.  
    eureka.server.e-i-p-bind-rebind-retries=3
  146.  
    # The time interval at which the server binds the EIP. If the binding is checked, it is re-bound if the binding fails. If and only if it is already bound
  147.  
    eureka.server.e-i-p-binding-retry-interval-ms=10
  148.  
    #Time interval at which the server binds EIP. If and only if the service is bound
  149.  
    eureka.server.e-i-p-binding-retry-interval-ms-when-unbound=
  150.  
    #The number of times the server tries to bind route53
  151.  
    eureka.server.route53-bind-rebind-retries=3
  152.  
    #Servlet interval how long to try to bind route53
  153.  
    eureka.server.route53-binding-retry-interval-ms=30
  154.  
    #
  155.  
    eureka.server.route53-domain-t-t-l=10

Eureka Instacen配置

  1.  
    #Hostname of the service registry instance
  2.  
    eureka.instance.hostname=localhost
  3.  
    #Register the application group name in the Eureka service
  4.  
    eureka.instance.app-group-name=
  5.  
    #Register the application name in the Eureka service
  6.  
    eureka.instance.appname=
  7.  
    # Unique ID of the instance registered to the service center
  8.  
    eureka.instance.instance-id=
  9.  
    #IP address of the instance
  10.  
    eureka.instance.ip-address=
  11.  
    #Instance, whether IP is preferred over hostname
  12.  
    eureka.instance.prefer-ip-address=false
  13.  
     
  14.  
    #Group name associated with this instance for automatic extension of the AWS platform,
  15.  
    eureka.instance.a-s-g-name=
  16.  
    #Deploy the data center for this instance
  17.  
    eureka.instance.data-center-info=
  18.  
    #Default address resolution order
  19.  
    eureka.instance.default-address-resolution-order=
  20.  
    #Instance environment configuration
  21.  
    eureka.instance.environment=
  22.  
    #Initialize the instance and register to the initial state of the service center
  23.  
    eureka.instance.initial-status=up
  24.  
    # Indicate whether as long as this instance is registered to the service center, immediately communicate
  25.  
    eureka.instance.instance-enabled-onit=false
  26.  
    #The namespace of the service instance for finding attributes
  27.  
    eureka.instance.namespace=eureka
  28.  
    #The child definition metadata of the service instance can be accepted by the service center.
  29.  
    eureka.instance.metadata-map.test = test
  30.  
     
  31.  
    #Service center deletes the waiting time (in seconds) of this service instance, and the time interval is the heartbeat time received by the last service center.
  32.  
    eureka.instance.lease-expiration-duration-in-seconds=90
  33.  
    # The interval at which the instance sends a heartbeat to the service center to indicate that the service instance is available.
  34.  
    eureka.instance.lease-renewal-interval-in-seconds=30
  35.  
    #Instance, registration service center, the number of communication opened by default
  36.  
    eureka.instance.registry.default-open-for-traffic-count=1
  37.  
    #Number of renewals per minute
  38.  
    eureka.instance.registry.expected-number-of-renews-per-min=1
  39.  
     
  40.  
    #Instance health check url, absolute path
  41.  
    eureka.instance.health-check-url=
  42.  
    #Instance health check url, relative path
  43.  
    eureka.instance.health-check-url-path=/health
  44.  
    #Instance's home page url, absolute path
  45.  
    eureka.instance.home-page-url=
  46.  
    #Instance's home page url, relative path
  47.  
    eureka.instance.home-page-url-path=/
  48.  
    #Instance security health check url, absolute path
  49.  
    eureka.instance.secure-health-check-url=
  50.  
    #https
  51.  
    eureka.instance.secure-port=443
  52.  
    #httpsCommunication port is enabled
  53.  
    eureka.instance.secure-port-enabled=false
  54.  
    #http
  55.  
    eureka.instance.non-secure-port=80
  56.  
    #httpCommunication port is enabled
  57.  
    eureka.instance.non-secure-port-enabled=true
  58.  
    #Security virtual host name (https) for this instance
  59.  
    eureka.instance.secure-virtual-host-name=unknown
  60.  
    #Virtual host name of this instance (http)
  61.  
    eureka.instance.virtual-host-name=unknown
  62.  
    #The status of the instance is rendered url, absolute path
  63.  
    eureka.instance.status-page-url=
  64.  
    #The status of the instance is rendered url, relative path
  65.  
    eureka.instance.status-page-url-path=/status

Eureka客户端配置

  1.  
    #This client is available
  2.  
    eureka.client.enabled=true
  3.  
    #Instance Whether to register your own information on the eureka server for other services to discover, the default is true
  4.  
    eureka.client.register-with-eureka=false
  5.  
    #This client gets the registration information on the eureka server registry, the default is true
  6.  
    eureka.client.fetch-registry=false
  7.  
    # Whether to filter out, non-UP instances. Default is true
  8.  
    eureka.client.filter-only-up-instances=true
  9.  
    # zone and url address with Eureka Registration Service Center
  10.  
    eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/
  11.  
     
  12.  
    #client is the idle waiting time after connecting to the Eureka server. The default is 30 seconds.
  13.  
    eureka.client.eureka-connection-idle-timeout-seconds=30
  14.  
    #client connects to eureka server connection timeout, the default is 5 seconds
  15.  
    eureka.client.eureka-server-connect-timeout-seconds=5
  16.  
    #clientRead timeout for the server
  17.  
    eureka.client.eureka-server-read-timeout-seconds=8
  18.  
    #clientConnection all eureka server total number of connections, the default 200
  19.  
    eureka.client.eureka-server-total-connections=200
  20.  
    #clientConnect to the number of single-machine connections on the eureka server. The default is 50.
  21.  
    eureka.client.eureka-server-total-connections-per-host=50
  22.  
    #Executive index rollback refresh related attribute, which is the maximum multiple of the retry delay, the default is 10
  23.  
    eureka.client.cache-refresh-executor-exponential-back-off-bound=10
  24.  
    #Execution program cache refresh thread pool size, the default is 5
  25.  
    eureka.client.cache-refresh-executor-thread-pool-size=2
  26.  
    # Execution program rollback related attributes, which is the maximum multiple of the retry delay. The default is 10
  27.  
    eureka.client.heartbeat-executor-exponential-back-off-bound=10
  28.  
    # Execution program thread pool size, the default is 5
  29.  
    eureka.client.heartbeat-executor-thread-pool-size=5
  30.  
    # Ask the frequency (s) of the Eureka service url information change, the default is 300 seconds
  31.  
    eureka.client.eureka-service-url-poll-interval-seconds=300
  32.  
    #The time (s) required to initially copy the instance information to the eureka server. The default is 40 seconds.
  33.  
    eureka.client.initial-instance-info-replication-interval-seconds=40
  34.  
    #How long does it take to copy the instance information to the eureka server again, the default is 30 seconds?
  35.  
    eureka.client.instance-info-replication-interval-seconds=30
  36.  
    #Time interval (s) from the eureka server registry to obtain registration information, the default is 30 seconds
  37.  
    eureka.client.registry-fetch-interval-seconds=30
  38.  
     
  39.  
    # Get the region where the instance is located. The default is us-east-1
  40.  
    eureka.client.region=us-east-1
  41.  
    #Instance Whether to use the eureka server in the same zone, the default is true. Ideally, the eureka client and server are in the same zone.
  42.  
    eureka.client.prefer-same-zone-eureka=true
  43.  
    # Get a list of available areas in the region where the instance is located, separated by commas. (AWS)
  44.  
    eureka.client.availability-zones.china=defaultZone,defaultZone1,defaultZone2
  45.  
    The list of comma-separated regions in the #eureka service registry information. If you do not return these regions, the client will start up with errors. The default is null
  46.  
    eureka.client.fetch-remote-regions-registry=
  47.  
    #Server is able to redirect client requests to the backup server. If set to false, the server will process the request directly, and if set to true, it may send an HTTP redirect to the client. Default is false
  48.  
    eureka.client.allow-redirects=false
  49.  
    #
  50.  
    eureka.client.client-data-accept=
  51.  
    #Incremental information can be provided to the client, the default is false
  52.  
    eureka.client.disable-delta=false
  53.  
    The #eureka server serialization/deserialization information obtains the replacement string of the "_" symbol. The default is"__"
  54.  
    eureka.client.escape-char-replacement=__
  55.  
    The #eureka server serialization/deserialization information obtains a replacement string for the "$" symbol. The default is"_-"
  56.  
    eureka.client.dollar-replacement="_-"
  57.  
    #When the server supports compression, whether to support the information obtained from the server for compression. Default is true
  58.  
    eureka.client.g-zip-content=true
  59.  
    # Whether to record the difference between the information in the registry between the eureka server and the client, the default is false
  60.  
    eureka.client.log-delta-diff=false
  61.  
    # If set to true, the client's status update will be updated on-demand to the remote server. The default is true.
  62.  
    eureka.client.on-demand-update-status-change=true
  63.  
    #This client is only interested in information about a single VIP registry. The default is null
  64.  
    eureka.client.registry-refresh-single-vip-address=
  65.  
    #client is forced to register to the service center during the initialization phase, the default is false
  66.  
    eureka.client.should-enforce-registration-at-init=false
  67.  
    #clientWhen the shutdown is displayed, the logout service is displayed from the service center. The default is true.
  68.  
    eureka.client.should-unregister-on-shutdown=true
  69.  
     
  70.  
    # Get the proxy host of the eureka service, the default is null
  71.  
    eureka.client.proxy-host=
  72.  
    #Get the proxy password of the eureka service, the default is null
  73.  
    eureka.client.proxy-password=
  74.  
    # Get the proxy port of the eureka service, the default is null
  75.  
    eureka.client.proxy-port=
  76.  
    # Get the proxy username of the eureka service, the default is null
  77.  
    eureka.client.proxy-user-name=
  78.  
     
  79.  
    #Attribute interpreter
  80.  
    eureka.client.property-resolver=
  81.  
    #Get the implementation name of the fallback option when the eureka client reads the registry at the first startup.
  82.  
    eureka.client.backup-registry-impl=
  83.  
    # ×××Configuration, if the latest XXX is stable, it can be removed, the default is null
  84.  
    eureka.client.decoder-name=
  85.  
    # , if the latest encoder is stable, it can be removed, the default is null
  86.  
    eureka.client.encoder-name=
  87.  
     
  88.  
    # Whether to use the DNS mechanism to get a list of services and then communicate. Default is false
  89.  
    eureka.client.use-dns-for-fetching-service-urls=false
  90.  
    #Get the DNS name to be queried to get the eureka server. This configuration is only used when the eureka server ip address list is in the DNS. The default is null
  91.  
    eureka.client.eureka-server-d-n-s-name=
  92.  
    #Get the port of the eureka server. This configuration is only used when the eureka server ip address list is in the DNS. The default is null
  93.  
    eureka.client.eureka-server-port=
  94.  
    # indicates the path of the eureka registration center. If it is configured as eureka, it is http://x.x.x.x:x/eureka/. Adding this configuration to the eureka configuration file indicates that eureka is registered as a client to the registration center to form an eureka cluster. This configuration is only used in the DNS address list of the eureka server. The default is null.
  95.  
    eureka.client.eureka-server-u-r-l-context=
原文地址:https://www.cnblogs.com/BlogNetSpace/p/11264235.html