Configuration Item Reference Manual

Contains all configuration components supported by Dubbo and all configuration items supported by each configuration component

Configuration Details

application

Each application must have one and only one application configuration, corresponding configuration class: org.apache.dubbo.config.ApplicationConfig

AttributeCorresponding URL parameterTypeRequiredDefault
nameapplicationstringRequiredService GovernanceThe name of the current application, which is used by the registry to calculate dependencies between applications. Note: the consumer and provider application names should not be the same, this parameter is not Matching conditions, you can fill in the name of your current project, which has nothing to do with the role of the provider and consumer. For example, if the kylin application calls the service of the morgan application, the kylin project will be kylin, and the morgan project will be morgan. Maybe kylin also provides other The service is used by others, but the kylin project will always be dubbed kylin, so the registry will show that kylin depends on morganversion 2.7 .0 or later
compilercompilerstringoptionaljavassistperformance optimizationJava bytecode compiler, used to generate dynamic classes, optional: jdk or javassistversion 2.7.0 or later
loggerloggerstringoptionalslf4jperformance optimizationlog output method, optional: slf4j, jcl, log4j, log4j2, jdkversion 2.7.0 or later
ownerownerstringOptionalService GovernanceThe person in charge of the application, used for service governance, please fill in the email prefix of the person in chargeVersion above 2.0.5
organizationorganizationstringOptionalService GovernanceOrganization name (BU or department), which is used by the registration center to distinguish service sources. It is recommended not to use autoconfig for this configuration item, and write it directly in the configuration, such as china, intl, itu, crm, asc, dw, aliexpress, etc.Version 2.0.0 and above
architecture
architecture
stringoptionalService Governance. Different architectures use different layers.Version 2.0. 7 and above
environmentenvironmentstringOptionalService GovernanceApplication environment, such as: develop/test/product, different environments use different default values, and it is only used as a restriction for developing and testing functions2.0.0 and above version
versionapplication.versionstringoptionalservice governancecurrent application versionversion 2.7.0 or later
dumpDirectorydump.directorystringOptionalService GovernanceWhen the process has a problem such as the thread pool is full, the storage path of the framework’s automatic dump fileVersion 2.7.0 or later
qosEnableqos.enablebooleanOptionalService governanceWhether to enable the qos operation and maintenance portVersion 2.7.0 or later
qosHostqos.hoststringOptionalService GovernanceNetwork interface address to monitor, default 0.0.0.0Version 2.7.3 or later
qosPortqos.portintoptionalservice governancenetwork port to monitorversion 2.7.0 or later
qosAcceptForeignIpqos.accept.foreign.ipbooleanOptionalService GovernanceSecurity configuration, whether to accept external requests except localhost local accessVersion 2.7.0 or later
shutwaitdubbo.service.shutdown.waitstringoptionalservice governanceshutdown waiting time (ms) during graceful shutdownversion 2.7.0 or later
hostnamestringoptionallocal hostnameservice governancehostnameversion 2.7.5 or later
registerConsumerregisterConsumerbooleanoptionaltrueservice governancewhether to register the instance to the registry. Only set to false when the instance is a pure consumerVersion 2.7.5 and above
repositoryapplication.versionstringoptionalservice governancecurrent application versionversion 2.7.6 or later
enableFileCachefile.cachebooleanoptionaltrueservice governancewhether to enable local cacheversion 3.0.0 or later
protocolstringoptionaldubboservice governancepreferred protocol, applicable when the preferred protocol cannot be determinedversion 3.0.0 or later
metadataTypemetadata-typeStringOptionallocalService GovernanceApplication-level service discovery The metadata delivery method is from the perspective of Provider, and the configuration on the Consumer side is invalid. The optional values are:
* remote - Provider Put the metadata in the remote registry, and the Consumer gets it from the registry;
* local - Provider puts the metadata locally, and the Consumer gets it directly from the Provider;
Version 2.7.5 and above
metadataServicePortmetadata-service-portintOptionalService GovernanceIf metadataType is configured as local, this property sets the port number used by the MetadataService serviceVersion 2.7.9 or later
livenessProbeliveness-probestringoptionalservice governanceconcept and format corresponding to k8s system liveness probeversion 3.0.0 or later
readinessProbereadiness-probestringoptionalservice governanceconcept and format corresponding to k8s system readiness probeversion 3.0.0 or later
startupProbestartup-probestringOptionalService GovernanceThe concept and format correspond to the k8s system startup probeVersion 3.0.0 or later
registerModeregister-modestringOptionalallService GovernanceControl address registration behavior, used for application-level service discovery and migration.
* instance only registers application-level addresses;
* interface only registers interface-level addresses;
* all (default) registers both application-level and interface-level addresses;
Version 3.0.0 and above
enableEmptyProtectionenable-empty-protectionbooleanOptionaltrueService GovernanceWhether to enable the protection of the empty address list on the consumer side globally. After enabling it, the empty address push from the registration center will be ignored. The default is trueVersion 3.0.0 or later
parametersNoneMap<string, string>OptionalService GovernanceReserved for extensions, any parameters can be extended and defined, and all extended parameters will be reflected in the URL configuration as they areVersion 2.7.0 and above

service

A service provider exposes service configuration. Corresponding configuration class: org.apache.dubbo.config.ServiceConfig

AttributeCorresponding URL parameterTypeRequiredDefault
interfaceclassrequiredservice discoveryservice interface nameversion 1.0.0 or later
refobjectrequiredservice discoveryservice object implementation referenceversion 1.0.0 or later
versionversionstringoptional0.0.0service discoveryservice version, it is recommended to use a two-digit version, such as: 1.0, usually the version number needs to be upgraded when the interface is not compatibleversion 1.0.0 or later
groupgroupstringoptionalservice discoveryservice grouping, when an interface has multiple implementations, they can be distinguished by groupingversion 1.0.7 or later
pathstringoptionaldefault interface nameservice discoveryservice path (note: 1.0 does not support custom path, always use the interface name, if there is 1.0 to 2.0, the configuration service path may not be Compatible)Version 1.0.12+
delaydelayintOptional0Performance tuningDelayed registration service time (milliseconds), when set to -1, it means that the service is delayed until the initialization of the Spring container is completedVersion 1.0.14 and above
timeouttimeoutintoptional1000performance tuningremote service call timeout (milliseconds)version 2.0.0 or later
retriesretriesintOptional2Performance tuningThe number of remote service call retries, excluding the first call, please set it to 0 if you don’t need to retryVersion 2.0.0 or later
connectionsconnectionsintoptional100performance tuningthe maximum number of connections for each provider, short connection protocols such as rmi, http, and hessian indicate the limit on the number of connections, and long connection agreements such as dubbo indicate the established long connections NumberVersion 2.0.0 or above
loadbalanceloadbalancestringoptionalrandomperformance tuningload balancing strategy, optional values:
* random - random;
* roundrobin - polling;
* leastactive - Least active calls; br/>* consistenthash - consistent hash (2.1.0+);
* shortestresponse - shortest response (2.7.7+);
2.0.0+
asyncasyncbooleanOptionalfalsePerformance tuningWhether to execute asynchronously by default, unreliable asynchronous, just ignore the return value, do not block the execution threadVersion above 2.0.0
locallocalclass/booleanoptionalfalseservice governanceset to true, means to use the default proxy class name, that is: interface name + Local suffix, obsolete, please use stub2.0.0 or above
stubstubclass/booleanOptionalfalseService GovernanceSet to true, which means to use the default proxy class name, that is: interface name + Stub suffix, the local proxy class name of the service interface client, used in the client The client executes local logic, such as local cache, etc. The constructor of the local proxy class must allow remote proxy objects to be passed in, such as: public XxxServiceStub(XxxService xxxService)Version 2.0.0 or later
mockmockclass/booleanOptionalfalseService GovernanceSet to true, which means to use the default Mock class name, that is: interface name + Mock suffix, if the service interface fails to call the Mock implementation class , the Mock class must have A no-argument constructor, the difference from Local is that Local is always executed, while Mock is only executed when non-business exceptions (such as timeouts, network exceptions, etc.) occur, Local is executed before remote calls, and Mock is executed after remote calls .Version 2.0.0 and above
tokentokenstring/booleanOptionalservice governanceConsumers bypass the registration center for direct access to ensure that the authorization function of the registration center is valid. If point-to-point calls are used, the token function must be turned offversion 2.0.0 or later
registrystringoptionaldefault registration to all registriesconfiguration associationregistration to the specified registry, used in multiple registries, the value is the id attribute of dubbo:registry, used for multiple registries IDs Separated by commas, If you don’t want to register the service to any registry, you can set the value to N/AVersion 2.0.0 or later
providerstringoptionalthe first provider configuration is used by defaultconfiguration associationspecify the provider, the value is the id attribute of dubbo:providerversion above 2.0.0
deprecateddeprecatedbooleanOptionalfalseService GovernanceWhether the service is deprecated, if set to true, the consumer will print the service deprecated warning error log2.0.5 or later
dynamicdynamicbooleanOptionaltrueService GovernanceWhether the service is dynamically registered, if it is set to false, the disabled status will be displayed after registration, and it needs to be manually enabled, and the registration will not be canceled automatically when the service provider stops , need to be disabled manually.Version 2.0.5 and above
accesslogaccesslogstring/booleanoptionalfalseservice managementset to true, the access log will be output to the logger, and the access log file path can also be filled in to output the access log directly to the specified file2.0.5 and above version
ownerownerstringoptionalservice governance
documentdocumentstringoptionalservice governanceservice document URLversion 2.0.5 or later
weightweightintoptionalperformance tuningservice weightversion 2.0.5 or later
executesexecutesintoptional0performance tuningthe maximum number of parallel execution requests per service and method of a service providerversion 2.0.5 or later
activesactivesintoptional0performance tuningmaximum number of concurrent calls per service consumer per service per methodversion 2.0.5 or later
proxyproxystringoptionaljavassistperformance tuninggenerate dynamic proxy, optional: jdk/javassistversion 2.0.5 or later
clusterclusterstringoptionalfailoverperformance tuningcluster mode, optional: failover/failfast/failsafe/failback/forking/available/mergeable (2.1. )/zone-aware (version 2.7.5 or later)version 2.0 .5 or later
filterservice.filterstringoptionaldefaultperformance tuningservice provider remote call process interceptor name, multiple names separated by commasversion 2.0.5 or later
listenerexporter.listenerstringoptionaldefaultperformance tuningservice provider export service listener name, multiple names separated by commas
protocolstringoptionalconfiguration associationuse the specified protocol to expose the service, used in multi-protocol, the value is the id attribute of dubbo:protocol, multiple protocol IDs are separated by commasversion 2.0 .5 or later
layerlayerstringoptionalservice governancethe layer where the service provider resides. Such as: biz, dao, intl:web, china:acton.Version 2.0.7 and above
registerregisterbooleanoptionaltrueservice governancewhether the service of this protocol is registered to the registryversion 2.0.8 or later
validationvalidationstringoptionalservice governancewhether to enable JSR303 standard annotation validation, if enabled, the annotations on the method parameters will be validatedversion 2.7.0 or later
parametersNoneMap<string, string>OptionalService GovernanceReserved for extensions, any parameters can be extended and defined, and all extended parameters will be reflected in the URL configuration as they areVersion 2.0.0 and above

reference

A service consumer references a service configuration. Corresponding configuration class: org.apache.dubbo.config.ReferenceConfig

AttributeCorresponding URL parameterTypeRequiredDefault
idstringrequiredconfiguration associationservice reference BeanIdversion 1.0.0 or later
interfaceclassrequiredservice discoveryservice interface nameversion 1.0.0 or later
versionversionstringoptionalservice discoveryservice version, consistent with the version of the service providerversion above 1.0.0
groupgroupstringoptionalservice discoveryservice grouping, when an interface has multiple implementations, they can be distinguished by grouping, must be consistent with the service providerversion 1.0.7 or later
timeouttimeoutlongoptionaltimeout of dubbo:consumer is used by defaultperformance tuningservice method call timeout (milliseconds)version 1.0.5 or later
retriesretriesintoptionalretries of dubbo:consumer are used by defaultperformance tuningretries of remote service calls, excluding the first call, please set to 02.0. Version 0 and above
connectionsconnectionsintoptionaldefault connections of dubbo:consumerperformance tuningthe maximum number of connections for each provider, rmi, http, hessian and other short connection protocols indicate the limit of the number of connections, dubbo The equal-length connection association indicates the number of established long connectionsVersion 2.0.0 or later
loadbalanceloadbalancestringoptionaldefault loadbalance of dubbo:consumerperformance tuningload balancing strategy, optional values:
* random - random;
* roundrobin - round
* leastactive - least active call;
* consistenthash - consistent hash (version 2.1.0 and above);
* shortestresponse - shortest response (version 2.7.7 and above);
2.0 .0+ version
asyncasyncbooleanoptionalasync of dubbo:consumer is used by defaultperformance tuningwhether to execute asynchronously, unreliable and asynchronous, just ignore the return value and not block the execution threadversion 2.0.0 or later
genericgenericbooleanoptionaldefault dubbo:consumer genericservice governancewhether to default the generic interface, if it is a generic interface, it will return GenericServiceversion 2.0.0 or later
checkcheckbooleanoptionaldefault check of dubbo:consumerservice governancecheck whether the provider exists at startup, true will report an error, false will ignoreversion 2.0.0 or later
urlurlstringoptionalservice governancepoint-to-point direct connection service provider address, will bypass the registration centerversion 1.0.6 or later
stubstubclass/booleanOptionalService GovernanceThe name of the service interface client’s local proxy class, which is used to execute local logic on the client, such as local cache, etc. The constructor of the local proxy class must allow input Remote proxy object, constructor such as: public XxxServiceLocal(XxxService xxxService)version 2.0.0 or later
mockmockclass/booleanOptionalService GovernanceService interface call failure Mock implementation class name, the Mock class must have a no-argument constructor, the difference from Local is that Local is always executed, while Mock Execute only When a non-business exception occurs (such as timeout, network exception, etc.), Local is executed before the remote call, and Mock is executed after the remote call.Supported by Dubbo1.0.13 and above
cachecachestring/booleanOptionalService GovernanceThe call parameter is used as the key to cache the returned result, optional: lru, threadlocal, jcache, etc.Supported by Dubbo2.1.0 and above
validationvalidationbooleanoptionalservice governancewhether to enable JSR303 standard annotation validation, if enabled, the annotations on the method parameters will be validatedDubbo2.1.0 and above versions support
proxyproxybooleanoptionaljavassistperformance tuningchoose dynamic proxy implementation strategy, optional: javassist, jdkversion above 2.0.2
clientclientstringoptionalperformance tuningclient transport type setting, such as netty or mina of Dubbo protocol.Supported by Dubbo2.0.0 and above
registrystringoptionalBy default, the service list will be obtained from all registries and the results will be mergedConfiguration AssociationRegister to obtain the service list from the specified registry, used when there are multiple registries, the value is dubbo:registry The id attribute, multiple registration center IDs are separated by commasVersion 2.0.0 or later
ownerownerstringOptionalService GovernanceTo call the person in charge of the service for service governance, please fill in the email prefix of the person in chargeVersion above 2.0.5
activesactivesintoptional0performance tuningmaximum number of concurrent calls per service consumer per service per methodversion 2.0.5 or later
clusterclusterstringoptionalfailoverperformance tuningcluster mode, optional: failover/failfast/failsafe/failback/forking/available/mergeable (2.1. )/zone-aware (version 2.7.5 or later)version 2.0 .5 or later
connectionsconnectionsintoptional100performance tuningthe maximum number of connections for each provider, short connection protocols such as rmi, http, and hessian indicate the limit on the number of connections, and long connection agreements such as dubbo indicate the established long connections NumberVersion 2.0.0 or above
filterreference.filterstringoptionaldefaultperformance tuningservice consumer remote call process interceptor name, multiple names separated by commasversion 2.0.5 or later
listenerinvoker.listenerstringoptionaldefaultperformance tuningThe service consumer quotes the name of the service listener, and multiple names are separated by commasVersion 2.0.5 or later
layerlayerstringoptionalservice governancethe layer where the service caller resides. Such as: biz, dao, intl:web, china:acton.Version 2.0.7 and above
initinitbooleanoptionalfalsePerformance tuningWhether to starvely initialize the reference when afterPropertiesSet(), otherwise wait until someone injects or references the instance before initializing.Version 2.0.10 and above
protocolprotocolstringoptionalservice governanceonly call the service provider of the specified protocol, and ignore other protocols.Version 2.7.0 and above
clientclientstringoptionaldubbo protocol defaults to nettyservice discoveryprotocol client implementation type, such as: dubbo protocol mina, netty, etc.version 2.7.0 or later
providerPortprovider-portintOptionalService MeshWhen dubbo.consumer.meshEnable=true, Dubbo will convert the request to K8S standard format by default, and combine VirtualService and DestinationRule for traffic management. At this time, the consumer can perceive to provider. If you don’t want to use VirtualService and DestinationRule, please set providerPort to make the consumer aware of the service port exposed by the providerVersion 3.1.0 and above
unloadClusterRelatedunloadClusterRelatedbooleanOptionalfalseService MeshWhen dubbo.consumer.meshEnable=true, in Service Mesh mode, set it to true to unload the Directory, Router and Load Balance related to the Cluster in the current call , Delegate retry, load balancing, timeout and other traffic management functions to Sidecar, use VirtualService and DestinationRule for traffic managementVersion 3.1.0 and above
parametersNoneMap<string, string>OptionalService GovernanceReserved for extensions, any parameters can be extended and defined, and all extended parameters will be reflected in the URL configuration as they areVersion 2.0.0 and above
providedByprovided-bystringOptionalService MeshWhen dubbo.consumer.meshEnable=true, Dubbo will convert the request to K8S standard format by default, and combine VirtualService and DestinationRule for traffic management. At this time, the consumer can perceive to provider. The value should be consistent with the declared k8s serviceVersion 3.1.0 or later
providerNamespaceprovider-namespacestringOptionalService MeshWhen dubbo.consumer.meshEnable=true, Dubbo will convert the request into K8S standard format by default, and combine VirtualService and DestinationRule for traffic management. At this time, the Consumer can perceive to provider. Please set the providerNamespace so that the consumer can address the provider dns according to this configuration, the default defaultversion 3.1.2 or later

registry

Registry configuration. Corresponding configuration class: org.apache.dubbo.config.RegistryConfig. At the same time, if there are multiple different registries, you can declare multiple <dubbo:registry> tags, and specify the registry to use in the registry attribute of <dubbo:service> or <dubbo:reference> .

AttributeCorresponding URL parameterTypeRequiredDefault
idstringoptionalconfiguration associationthe registration center references the BeanId, which can be referenced in <dubbo:service registry=""> or <dubbo:reference registry="">version 1.0.16 or later
addresshost:portstringRequiredService discoveryThe address of the registration center server. If the address has no port, the default is 9090. Multiple addresses in the same cluster are separated by commas. Such as: ip:port, ip:port, registry centers of different clusters, please configure multiple dubbo:registry tagsVersion 1.0.16 or later
protocolstringoptionaldubboservice discoveryregistry address protocol, support dubbo, multicast, zookeeper, redis, consul(2.7. .2), etcd( 2.7.2), nacos(2.7.2) and other protocolsVersion 2.0.0 and above
portintoptional9090service discoverythe default port of the registry, when the address does not have a port, use this port as the default valueversion 2.0.0 or later
usernamestringOptionalService GovernanceUsername for logging in to the registration center, if the registration center does not require verification, it can be left blankVersion 2.0.0 or later
passwordstringOptionalService GovernancePassword for logging in to the registration center, if the registration center does not require verification, you can leave it blankVersion 2.0.0 or later
transportregistry.transporterstringoptionalnettyperformance tuningnetwork transport mode, optional mina, nettyversion 2.0.0 or later
timeoutregistry.timeoutintoptional5000performance tuningregistry center request timeout (milliseconds)version 2.0.0 or later
sessionregistry.sessionintoptional60000Performance tuningRegistry session timeout (milliseconds), used to detect dirty data after abnormal disconnection of the provider, such as the implementation of heartbeat detection, this time It is the heartbeat interval , which is different for different registration centers.Version 2.1.0 and above
zonezonestringoptionalservice governancethe region to which the registry belongs, usually used for traffic isolationversion 2.7.5 or later
fileregistry.filestringOptionalService GovernanceUse a file to cache the registry address list and service provider list. When the application is restarted, it will be restored based on this file. Note: two registries cannot use the same file storageVersion 2.0.0 or later
waitregistry.waitintoptional0performance tuningwait notification completion time (milliseconds) when stoppingversion 2.0.0 or later
checkcheckbooleanoptionaltrueservice governancewhether to report an error when the registration center does not existversion 2.0.0 or later
registerregisterbooleanOptionaltrueService GovernanceWhether to register the service with this registry, if set to false, it will only subscribe and not registerVersion 2.0.5 and above
subscribesubscribebooleanoptionaltrueservice governancewhether to subscribe to this registry service, if set to false, it will only register, not subscribeversion 2.0.5 or later
dynamicdynamicbooleanOptionaltrueService GovernanceWhether the service is dynamically registered, if it is set to false, it will be displayed as disabled after registration, it needs to be manually enabled, and when the service provider stops , it will not be automatically unregistered , need to be disabled manually.Version 2.0.5 and above
groupgroupstringOptionaldubboService GovernanceService registration grouping, cross-group services will not affect each other, and cannot call each other, suitable for environment isolation.Version 2.0.5 and above
versionversionstringoptionalservice discoveryservice versionversion above 1.0.0
simplifiedsimplifiedbooleanoptionalfalseservice governancewhether the URL registered to the registration center is in simplified mode (compatible with lower versions)version 2.7.0 or later
extra-keysextraKeysstringOptionalService GovernanceWhen simplified=true, extraKeys allows you to put extra keys in the URL besides the default parameters, in the format: “interface,key1,key2”.Version 2.7 .0 and above
useAsConfigCenterbooleanoptionalservice governancewhether the registry is used as a configuration centerversion 2.7.5 or later
useAsMetadataCenterbooleanoptionalservice governancewhether the registry is used as a metadata centerversion 2.7.5 or later
acceptsacceptsstringOptionalService GovernanceThe registry receives a list of rpc protocols, multiple protocols are separated by commas, such as dubbo, restversion 2.7.5 or later
preferredpreferredbooleanoptionalservice governancewhether to be the preferred registry. When subscribing to multiple registries, if set to true, the registries will be preferredVersion 2.7.5 and above
weightweightintoptionalperformance tuningregistration traffic weight. When using multiple registries, you can use this value to adjust the distribution of registration traffic. This value does not take effect when setting the preferred registryVersion 2.7. 5 or later
registerModeregister-modestringOptionalallService GovernanceControl address registration behavior, used for application-level service discovery and migration.
* instance only registers application-level addresses;
* interface only registers interface-level addresses;
* all (default) registers both application-level and interface-level addresses;
Version 3.0.0 and above
enableEmptyProtectionenable-empty-protectionbooleanOptionaltrueService GovernanceWhether to enable the protection of the empty address list on the consumer side globally. After enabling it, the empty address push from the registration center will be ignored. The default is trueVersion 3.0.0 or later
parametersNoneMap<string, string>OptionalService GovernanceReserved for extensions, any parameters can be extended and defined, and all extended parameters will be reflected in the URL configuration as they areVersion 2.0.0 and above

config-center

configuration center. Corresponding configuration class: org.apache.dubbo.config.ConfigCenterConfig

| Attribute | Corresponding URL parameter | Type | Required | Default | Description | Compatibility | | —————- | ———————- | ——— ———- | ——– | —————- | ————- ————————————————– | – —- | | protocol | protocol | string | optional | zookeeper | Which configuration center to use: apollo, zookeeper, nacos, etc.
Take zookeeper as an example
1. If the protocol is specified, the address can be simplified to 127.0.0.1:2181;
2. If the protocol is not specified, the address value will be zookeeper:// 127.0.0.1:2181 | Version 2.7.0 or higher | | address | address | string | Mandatory | | Configuration center address.
See the protocol description for the value | Version 2.7.0 and above | | highestPriority | highest-priority| boolean | optional | true | The configuration item from the configuration center has the highest priority, that is, the local configuration item will be overwritten. | Version 2.7.0 and above | | namespace | namespace | string | optional | dubbo | Usually used for multi-tenant isolation, the actual meaning depends on the specific configuration center.
Such as:
zookeeper - environment isolation, the default value is dubbo;
apollo - distinguishes configuration sets in different domains, using dubbo and application by default | Version 2.7.0 and above | | cluster | cluster | string | optional | | The meaning depends on the selected configuration center.
It is used to distinguish different configuration clusters in Apollo | Version 2.7.0 and above | group | group | string | optional | dubbo | The meaning depends on the selected configuration center.
nacos - isolate different configuration sets
zookeeper - isolate different configuration sets | Version 2.7.0 and above | | check | check | boolean | optional | true | Whether to terminate the application startup when the connection to the configuration center fails. | Version 2.7.0 and above | | configFile | config-file | string | optional | dubbo.properties | the key to which the global configuration file is mapped
zookeeper - default path /dubbo/config/dubbo/dubbo.properties
apollo - dubbo dubbo.properties key in namespace | Version 2.7.0 or later | | appConfigFile | app-config-file | string | optional | | “configFile” is shared globally. This item is restricted to properties configured by this application | 2.7.0+ | | timeout | timeout | int | optional | 3000ms | get the configured timeout | version 2.7.0 or later | | username | username | string | optional | | If the configuration center needs to be verified, the username
Apollo is not enabled yet | Version 2.7.0 or later | | password | password | string | Optional | | If the configuration center needs to be verified, the password
Apollo is not enabled yet | Version 2.7.0 or later | | parameters | parameters | Map<string, string> | Optional | | Extended parameters, used to support customized configuration parameters of different configuration centers | Version 2.7.0 or later | | includeSpringEnv |include-spring-env| boolean | Optional | false | Supported when using the Spring framework. When true, the configuration will be automatically read from the Spring Environment.
By default,
key is dubbo .properties configuration
key is Dubbo.properties PropertySource | Version 2.7.0 or above |

metadata-report-config

metadata center. Corresponding configuration class: org.apache.dubbo.config.MetadataReportConfig

| Attribute | Corresponding URL parameter | Type | Required | Default | Description | Compatibility | | ————— | ——— | —— | ——– | ——- – | ———————————————– ————- | —— | | address | address | string | required | | metadata center address. | Version 2.7.0 and above | protocol | protocol | string | optional | zookeeper | metadata center protocol: zookeeper, nacos, redis, etc.
Take zookeeper as an example
1. If the protocol is specified, the address can be simplified to 127.0.0.1:2181;
2. If the protocol is not specified, the address value will be zookeeper:// 127.0.0.1:2181 | Version 2.7.13 and above | | port | port | int | optional | | metadata center port number. Specify the port, then the address can be simplified, no need to configure the port number | Version 2.7.13 or later | | username | username | string | optional | | metadata center needs to be verified, username
Apollo is not enabled yet | version 2.7.0 or later | | password | password | string | Optional | | The metadata center needs to be verified, and the password
Apollo is not enabled yet | Version 2.7.0 or later | | timeout | timeout | int | optional | | get metadata timeout (ms) | version 2.7.0 or later | | group | group | string | optional | dubbo | Metadata grouping, suitable for environment isolation. It has the same meaning as the registration center group | Version 2.7.0 and above | | retryTimes | retry-times | int | optional | 100 | number of retries | version 2.7.0 or later | | retryPeriod | retry-period | int | optional | 3000ms | retry interval (ms) | version 2.7.0 or later | | cycleReport | cycle-report | boolean| optional | true | Whether to update full metadata every day | Version 2.7.0 and above | | syncReport | sync-report | boolean| optional | false | whether to update metadata synchronously, the default is asynchronous | version 2.7.0 or later | | cluster | cluster | string | optional | | The meaning depends on the selected metadata center.
It is used to distinguish different configuration clusters in Apollo | Version 2.7.0 and above | | file | file | string | optional | | use the file cache metadata center list, when the application is restarted, it will be restored based on this file, note: two metadata centers cannot use the same file storage | version 2.7.0 or later | | check | check | boolean | optional | true | Whether to terminate the application startup when the metadata center connection fails. | Version 3.0.0 and above | | reportMetadata | report-metadata | boolean | Optional | false | Whether to upload the interface configuration report metadata in the address discovery, dubbo.application.metadata-type=remote If the configuration does not work, it will be reported, dubbo. Whether to report when application.metadata-type=local is determined by the configuration value | Version 3.0.0 or later | | reportDefinition | report-definition | boolean | Optional | true | Whether to report metadata for service operation and maintenance | Version 3.0.0 or later | | reportConsumerDefinition | report-consumer-definition | boolean | Optional | true | Whether to report metadata for service operation and maintenance on the consumer side | Version 3.0.0 or later | | parameters | parameters | Map<string, string> | Optional | | Extended parameters, used to support customized configuration parameters of different metadata centers | Version 2.7.0 or later |

protocol

Service provider protocol configuration. Corresponding configuration class: org.apache.dubbo.config.ProtocolConfig. At the same time, if you need to support multiple protocols, you can declare multiple <dubbo:protocol> tags, and specify the used protocol through the protocol attribute in <dubbo:service>.

AttributeCorresponding URL parameterTypeRequiredDefault
idstringoptionaldubboconfiguration associationprotocol BeanId, you can refer to this ID in <dubbo:service protocol="">, if the ID is not filled, the default is the same as the value of the name attribute, and if it is repeated, it will be in the name followed by the serial number.Version 2.0.5 and above
namestringRequireddubboPerformance tuningProtocol nameVersion above 2.0.5
portintoptionalThe default port of dubbo protocol is 20880, the default port of rmi protocol is 1099, the default port of http and hessian protocol is 80; if no port is configured, The default port will be used automatically, if configured as -1, an unoccupied port will be allocated. For Dubbo 2.4.0+, the allocated port is increased on the basis of the default port of the protocol to ensure that the port segment is controllable.Service DiscoveryService PortVersion 2.0.5 and above
hoststringOptionalAutomatically find local IPService discovery- Service host name, used when selecting multiple network cards or specifying VIP and domain name, if it is empty, it will automatically find local IP, - it is recommended not to configure , let Dubbo automatically obtain the local IPversion 2.0.5 or later
threadpoolthreadpoolstringoptionalfixedperformance tuningthread pool type, optional: fixed/cached/limit (above 2.5.3)/eager (above 2.6.x)version 2.0.5 or above
threadnamethreadnamestringoptionalperformance tuningthread pool nameversion 2.7.6 or later
threadsthreadsintoptional200performance tuningservice thread pool size (fixed size)version 2.0.5 or later
corethreadscorethreadsintoptional200performance tuningthread pool core thread sizeversion 2.0.5 or later
iothreadsthreadsintoptionalnumber of cpus + 1performance tuningio thread pool size (fixed size)version 2.0.5 or later
acceptsacceptsintoptional0
payloadpayloadintoptional8388608(=8M)performance tuningrequest and response packet size limit, unit: byteversion 2.0.5 or later
codeccodecstringoptionaldubboperformance tuningprotocol encodingversion 2.0.5 or later
serializationserializationstringoptionaldubbo protocol defaults to hessian2, rmi protocol defaults to java, http protocol defaults to jsonperformance tuningprotocol serialization method, used when the protocol supports multiple serialization methods , such as: dubbo, hessian2, java, compactedjava of dubbo protocol, and json of http protocol, etc.Version 2.0.5 and above
accesslogaccesslogstring/booleanOptionalService GovernanceSet to true, the access log will be output to the logger, you can also fill in the access log file path, directly output the access log to the specified fileVersion 2.0.5 or later
pathstringoptionalservice discoveryprovider context path, prefix of service pathversion 2.0.5 or later
transportertransporterstringoptionaldubbo protocol defaults to nettyperformance tuningprotocol server and client implementation types, such as: dubbo protocol mina, netty, etc., can be split into server and client configurationVersion 2.0.5 and above
serverserverstringOptionalDubbo protocol defaults to netty, http protocol defaults to servletPerformance tuningThe server-side implementation type of the protocol, such as: mina, netty of dubbo protocol, etc., jetty of http protocol, servlet, etc.Version 2.0.5 and above
clientclientstringOptionalDubbo protocol defaults to nettyPerformance tuningProtocol client implementation type, such as: dubbo protocol mina, netty, etc.Version 2.0.5 or later
dispatcherdispatcherstringoptionaldubbo protocol defaults to allperformance tuningprotocol message distribution method, used to specify the thread model, such as: all, direct, message, execution, connection, etc. of dubbo protocol2.1 .0+ version
queuesqueuesintoptional0performance tuningthread pool queue size, when the thread pool is full, the size of the queue waiting to be executed, it is recommended not to set, when the thread pool is full, it should fail immediately, and retry other Serving provisioning machines, rather than queuing, unless there is a special need.Version 2.0.5 and above
charsetcharsetstringoptionalUTF-8performance tuningserialization encodingversion 2.0.5 or later
bufferbufferintoptional8192performance tuningnetwork read and write buffer sizeversion 2.0.5 or later
heartbeatheartbeatintOptional0Performance TuningA heartbeat is required to help check if a connection is broken2.0.10+
telnettelnetstringOptionalService GovernanceSupported telnet commands, separated by commasVersion 2.0.5 and above
registerregisterbooleanoptionaltrueservice governancewhether the service of this protocol is registered to the registryversion 2.0.8 or later
contextpathcontextpathStringoptionaldefault is empty stringservice governancecontext pathversion 2.0.6 or later
sslEnabledssl-enabledbooleanoptionalfalseservice governancewhether to enable sslversion 2.7.5 or later
parametersparametersMap<string, string>optionalextended parametersversion 2.0.0 or later

provider

Service provider default configuration. Corresponding configuration class: org.apache.dubbo.config.ProviderConfig. At the same time, this tag is the default value setting of <dubbo:service> and <dubbo:protocol> tags.

AttributeCorresponding URL parameterTypeRequiredDefault
idstringoptionaldubboconfiguration associationprotocol BeanId, you can refer to this ID in <dubbo:service proivder="">version above 1.0.16
protocolstringoptionaldubboperformance tuningprotocol nameversion 1.0.16 or later
hoststringOptionalAutomatically search for local IPService discoveryService host name, used when selecting multiple network cards or specifying VIP and domain name, if it is empty, it will automatically search for local IP. Dubbo automatically obtains the local IPversion 1.0.16 or later
threadsthreadsintoptional200performance tuningservice thread pool size (fixed size)version 1.0.16 or later
payloadpayloadintoptional8388608(=8M)performance tuningrequest and response packet size limit, unit: byteversion above 2.0.0
pathstringoptionalservice discoveryprovider context path, prefix of service pathversion 2.0.0 or later
transportertransporterstringoptionaldubbo protocol defaults to nettyperformance tuningprotocol server and client implementation types, such as: dubbo protocol mina, netty, etc., can be split into server and client configurationVersion 2.0.5 and above
serverserverstringOptionalDubbo protocol defaults to netty, http protocol defaults to servletPerformance tuningThe server-side implementation type of the protocol, such as: mina, netty of dubbo protocol, etc., jetty of http protocol, servlet, etc.Version 2.0.0 and above
clientclientstringOptionalDubbo protocol defaults to nettyPerformance tuningProtocol client implementation type, such as: dubbo protocol mina, netty, etc.Version 2.0.0 or later
dispatcherdispatcherstringoptionaldubbo protocol defaults to allperformance tuningprotocol message distribution method, used to specify the thread model, such as: all, direct, message, execution, connection, etc. of dubbo protocol2.1 .0+ version
codeccodecstringoptionaldubboperformance tuningprotocol encodingversion 2.0.0 or later
serializationserializationstringoptionaldubbo protocol defaults to hessian2, rmi protocol defaults to java, http protocol defaults to jsonperformance tuningprotocol serialization method, used when the protocol supports multiple serialization methods , such as: dubbo, hessian2, java, compactedjava of the dubbo protocol, and json, xml of the http protocolVersion 2.0.5 and above
defaultbooleanoptionalfalseconfiguration associationwhether it is the default protocol, used for multi-protocolversion 1.0.16 or later
filterservice.filterstringoptionalperformance tuningservice provider remote call process interceptor name, multiple names separated by commasversion 2.0.5 or later
listenerexporter.listenerstringoptionalperformance tuningservice provider export service listener name, multiple names separated by commasversion 2.0.5 or later
threadpoolthreadpoolstringoptionalfixedperformance tuningthread pool type, optional: fixed/cached/limit (above 2.5.3)/eager (above 2.6.x)version 2.0.5 or above
threadnamethreadnamestringoptionalperformance tuningthread pool nameversion 2.7.6 or later
acceptsacceptsintoptional0
versionversionstringoptional0.0.0service discoveryservice version, it is recommended to use a two-digit version, such as: 1.0, usually the version number needs to be upgraded when the interface is incompatibleversion 2.0.5 or later
groupgroupstringoptionalservice discoveryservice grouping, when an interface has multiple implementations, they can be distinguished by groupingversion 2.0.5 or later
delaydelayintOptional0Performance tuningDelayed registration service time (milliseconds) - When set to -1, it means that the service is delayed until the initialization of the Spring container is completedVersion 2.0.5 and above
timeoutdefault.timeoutintoptional1000performance tuningremote service call timeout (milliseconds)version 2.0.5 or later
retriesdefault.retriesintoptional2Performance tuningThe number of remote service call retries, excluding the first call, please set it to 0 if you don’t need to retryVersion 2.0.5 or later
connectionsdefault.connectionsintoptional0performance tuningthe maximum number of connections for each provider, short connection protocols such as rmi, http, and hessian indicate the limit on the number of connections, long connection agreements such as dubbo indicate the established The number of long connectionsVersion 2.0.5 and above
loadbalancedefault.loadbalancestringoptionalrandomperformance tuningload balancing strategy, optional values:
* random - random;
* roundrobin - round robin; leastactive - least active call;
* consistenthash - consistent hash (2.1.0+);
* shortestresponse - shortest response (2.7.7+);
2.0.5+
asyncdefault.asyncbooleanoptionalfalseperformance tuningwhether to execute asynchronously by default, unreliable and asynchronous, just ignore the return value and not block the execution threadVersion 2.0.5 and above
stubstubbooleanOptionalfalseService GovernanceIf set to true, it means to use the default proxy class name, namely: interface name + Local suffix.Version 2.0.5 and above
mockmockbooleanOptionalfalseService GovernanceSet to true to use the default Mock class name, namely: interface name + Mock suffix.Version 2.0.5 and above
tokentokenbooleanOptionalService GovernanceToken verification, empty means not enabled, if true, means randomly generated dynamic tokensVersion 2.0.5 and above
registryregistrystringoptionalregister with all registries by defaultconfiguration associationregister with the specified registry, used when there are multiple registries, the value is the id attribute of dubbo:registry, multiple registry IDs Separated by commas, if you do not want to register the service to any registry, you can set the value to N/AVersion 2.0.5 or later
dynamicdynamicbooleanOptionaltrueService GovernanceWhether the service is dynamically registered, if it is set to false, the disabled status will be displayed after registration, and it needs to be manually enabled, and the registration will not be canceled automatically when the service provider stops , need to be disabled manually.Version 2.0.5 and above
accesslogaccesslogstring/booleanoptionalfalseservice managementset to true, the access log will be output to the logger, and the access log file path can also be filled in to output the access log directly to the specified file2.0.5 and above version
ownerownerstringoptionalservice governance
documentdocumentstringoptionalservice governanceservice document URLversion 2.0.5 or later
weightweightintoptionalperformance tuningservice weightversion 2.0.5 or later
executesexecutesintoptional0performance tuningthe maximum number of parallel execution requests per service and method of a service providerversion 2.0.5 or later
activesdefault.activesintoptional0performance tuningmaximum number of concurrent calls per service consumer per service per methodversion 2.0.5 or later
proxyproxystringoptionaljavassistperformance tuninggenerate dynamic proxy, optional: jdk/javassistversion 2.0.5 or later
clusterdefault.clusterstringoptionalfailoverperformance tuningcluster mode, optional: failover/failfast/failsafe/failback/forkingversion above 2.0.5
deprecateddeprecatedbooleanOptionalfalseService GovernanceWhether the service is deprecated, if set to true, the consumer will print the service deprecated warning error log2.0.5 or later
queuesqueuesintoptional0performance tuningthread pool queue size, when the thread pool is full, the size of the queue waiting to be executed, it is recommended not to set, when the thread pool is full, it should fail immediately, and retry other Serving provisioning machines, rather than queuing, unless there is a special need.Version 2.0.5 and above
charsetcharsetstringoptionalUTF-8performance tuningserialization encodingversion 2.0.5 or later
bufferbufferintoptional8192performance tuningnetwork read and write buffer sizeversion 2.0.5 or later
iothreadsiothreadsintOptionalCPU + 1Performance tuningIO thread pool, receive network read and write interrupts, serialize and deserialize, do not process business, business thread pool see threads configuration, this thread pool It is related to the CPU and is not recommended to be configured.Version 2.0.5 and above
alivealiveintoptionalservice managementthread pool keepAliveTime, the default unit is msversion 2.0.5 or later
telnettelnetstringOptionalService GovernanceSupported telnet commands, separated by commasVersion 2.0.5 and above
waitwaitintOptionalService GovernanceWaiting time when stopping the service
contextpathcontextpathStringoptionaldefault is empty stringservice governancecontext pathversion 2.0.6 or later
layerlayerstringoptionalservice governancethe layer where the service provider resides. Such as: biz, dao, intl:web, china:acton.Version 2.0.7 and above
parametersparametersMap<string, string>optionalservice governanceextended parametersversion 2.0.0 or later

consumer

Service consumer default configuration. Configuration class: org.apache.dubbo.config.ConsumerConfig. At the same time, this tag is the default value setting of the <dubbo:reference> tag.

AttributeCorresponding URL parameterTypeRequiredDefault
timeoutdefault.timeoutintoptional1000performance tuningremote service call timeout (milliseconds)version 1.0.16 or later
retriesdefault.retriesintoptional2Performance tuningThe number of remote service call retries, excluding the first call, please set it to 0 if you do not need to retry, it is only valid when the cluster is failback/failoverVersion 1.0.16 and above
loadbalancedefault.loadbalancestringoptionalrandomperformance tuningload balancing strategy, optional values:
* random - random;
* roundrobin - round robin; leastactive - least active call;
* consistenthash - consistent hash (2.1.0+);
* shortestresponse - shortest response (2.7.7+);
1.0.16+
asyncdefault.asyncbooleanoptionalfalseperformance tuningwhether to execute asynchronously by default, unreliable and asynchronous, just ignore the return value and not block the execution threadVersion 2.0.0 or later
sentdefault.sentbooleanoptionaltrueservice governancewhen calling asynchronously, when the flag sent=true, it means that the network has sent dataversion 2.0.6 or later
connectionsdefault.connectionsintoptional100performance tuningthe maximum number of connections for each service to each provider, rmi, http, hessian and other short connection protocols support this configuration, dubbo protocol long connection does not support This configuration1.0.16+ version
genericgenericbooleanoptionalfalseservice governancewhether to default the generic interface, if it is a generic interface, it will return GenericServiceversion above 2.0.0
checkcheckbooleanOptionaltrueService GovernanceCheck whether the provider exists at startup, true reports an error, false ignoresversion 1.0.16 and above
proxyproxystringoptionaljavassistperformance tuninggenerate dynamic proxy, optional: jdk/javassistversion 2.0.5 or later
ownerownerstringOptionalService GovernanceTo call the person in charge of the service for service governance, please fill in the email prefix of the person in chargeVersion above 2.0.5
activesdefault.activesintoptional0performance tuningmaximum number of concurrent calls per service consumer per service per methodversion 2.0.5 or later
clusterdefault.clusterstringoptionalfailoverperformance tuningcluster mode, optional: failover/failfast/failsafe/failback/forking/available/mergeable (2.1. above)/zone-aware(2.7.5 above)2.0.5 above
filterreference.filterstringoptionalperformance tuningservice consumer remote call process interceptor name, multiple names separated by commasversion 2.0.5 or later
listenerinvoker.listenerstringoptionalperformance tuningthe service consumer quotes the name of the service listener, multiple names are separated by commasversion 2.0.5 or later
registrystringoptionaldefault registration to all registriesconfiguration associationregistration to the specified registry, used in multiple registries, the value is the id attribute of dubbo:registry, used for multiple registries IDs Separated by commas, if you do not want to register the service to any registry, you can set the value to N/AVersion 2.0.5 or later
layerlayerstringoptionalservice governancethe layer where the service caller resides. Such as: biz, dao, intl:web, china:acton.Version 2.0.7 and above
initinitbooleanoptionalfalsePerformance tuningWhether to starvely initialize the reference when afterPropertiesSet(), otherwise wait until someone injects or references the instance before initializing.Version 2.0.10 and above
cachecachestring/booleanOptionalService GovernanceThe call parameter is used as the key to cache the returned result, optional: lru, threadlocal, jcache, etc.Supported by version 2.1.0 and above
validationvalidationbooleanoptionalservice governancewhether to enable JSR303 standard annotation validation, if enabled, the annotations on the method parameters will be validated2.1.0 and above version support
versionversionstringoptionalservice governanceconfigure multiple versions for the same service in Dubbo2.2.0 and above versions support
clientclientstringOptionalDubbo protocol defaults to nettyPerformance tuningProtocol client implementation type, such as: dubbo protocol mina, netty, etc.Version 2.0.0 or later
threadpoolthreadpoolstringoptionalfixedperformance tuningthread pool type, optional: fixed/cached/limit (above 2.5.3)/eager (above 2.6.x)version 2.0.5 or above
corethreadscorethreadsintoptional200performance tuningthread pool core thread sizeversion 2.0.5 or later
threadsthreadsintoptional200performance tuningservice thread pool size (fixed size)version 2.0.5 or later
queuesqueuesintoptional0performance tuningthread pool queue size, when the thread pool is full, the size of the queue waiting to be executed, it is recommended not to set, when the thread pool is full, it should fail immediately, and retry other Serving provisioning machines, rather than queuing, unless there is a special need.Version 2.0.5 and above
shareconnectionsshareconnectionsintoptional1performance tuningnumber of shared connections. When the connection parameter is set to 0, the shared mode connection will be enabled, and there is only one connection by default. Only supports dubbo protocolversion 2.7.0 and above
referThreadNumintoptionalperformance optimizationthread pool size for asynchronous callsversion 3.0.0 or later
meshEnablemesh-enablebooleanoptionalfalseService MeshDubbo Mesh mode switch. After it is turned on, it can adapt to the SideCar mode and convert Dubbo service calls to K8S standard calls. Only supports the Triple protocol and is compatible with GRPC. After setting to true, the native docking K8S, no third-party registration center is required, just set dubbo.registry.address=N/AVersion 3.1.0 or later
parametersparametersMap<string, string>optionalservice governanceextended parametersversion 2.0.0 or later

metrics

Indicator configuration. Configuration class: org.apache.dubbo.config.MetricsConfig

AttributeCorresponding URL parameterTypeRequiredDefault
protocolprotocolstringoptionalprometheusperformance tuningprotocol name, prometheus is used by defaultversion 3.0.0 or later
prometheusPrometheusConfigoptionalconfiguration associationprometheus related configurationversion 3.0.0 or later
aggregationAggregationConfigOptionalConfiguration associationIndicator aggregation related configurationVersion 3.0.0 or later
  • PrometheusConfig corresponding class: org.apache.dubbo.config.nested.PrometheusConfig
AttributeTypeRequiredDefaultDescription
exporter.enabledbooleanoptionalwhether to enable prometheus exporter
exporter.enableHttpServiceDiscoverybooleanoptionalwhether to enable http service discovery
exporter.httpServiceDiscoveryUrlstringoptionalhttp service discovery URL
exporter.metricsPortintoptionalport number to expose when using the pull method
exporter.metricsPathstringoptionalpath to expose metrics when using pull method
pushgateway.enabledbooleanoptionalwhether to publish metrics through the Pushgateway of prometheus
pushgateway.baseUrlstringoptionalPushgateway address
pushgateway.usernamestringoptionalPushgateway username
pushgateway.passwordstringoptionalPushgateway password
pushgateway.pushIntervalintoptionalpush indicator interval time
  • AggregationConfig corresponding class: org.apache.dubbo.config.nested.AggregationConfig
AttributeTypeRequiredDefaultDescription
enabledbooleanoptionalWhether to enable the local indicator aggregation function
bucketNumintoptionalthe number of time window buckets
timeWindowSecondsintoptionaltime window duration (s)

ssl

TLS authentication configuration. Configuration class: org.apache.dubbo.config.SslConfig

AttributeCorresponding URL parameterTypeRequiredDefault
serverKeyCertChainPathserver-key-cert-chain-pathstringoptionalsecurity configuration
serverPrivateKeyPathserver-private-key-pathstringoptionalsecurity configurationserver private key pathversion 2.7.5 or later
serverKeyPasswordserver-key-passwordstringoptionalsecurity configurationserver key passwordversion 2.7.5 or later
serverTrustCertCollectionPathserver-trust-cert-collection-pathstringoptionalsecurity configurationserver trust certificate pathversion 2.7.5 or later
clientKeyCertChainPathclient-key-cert-chain-pathstringoptionalsecurity configurationclient signature certificate pathversion 2.7.5 or later
clientPrivateKeyPathclient-private-key-pathstringoptionalsecurity configurationclient private key pathversion 2.7.5 or later
clientKeyPasswordclient-key-passwordstringoptionalsecurity configurationclient key passwordversion 2.7.5 or later
clientTrustCertCollectionPathclient-trust-cert-collection-pathstringoptionalsecurity configurationclient trust certificate pathversion 2.7.5 or later

module

Module information configuration. The corresponding configuration class org.apache.dubbo.config.ModuleConfig

AttributeCorresponding URL parameterTypeRequiredDefault
namemodulestringRequiredService GovernanceCurrent module name, used by the registry to calculate dependencies between modulesVersion 2.2.0 or later
versionmodule.versionstringoptionalservice governancecurrent module versionversion 2.2.0 or later
ownermodule.ownerstringOptionalService GovernanceThe person in charge of the module, used for service governance, please fill in the email prefix of the person in chargeVersion above 2.2.0
organizationmodule.organizationstringOptionalService GovernanceOrganization name (BU or department), which is used by the registration center to distinguish service sources. It is recommended not to use autoconfig for this configuration item, and write it directly in the configuration, such as China, intl, itu, crm, asc, dw, aliexpress, etc.Version 2.2.0 and above
backgroundbackgroundbooleanoptionalperformance tuningwhether to enable the background startup mode. If enabled, there is no need to wait for the spring ContextRefreshedEvent event to completeVersion 3.0.0 and above
referAsyncreferAsyncbooleanOptionalPerformance tuningWhether to enable asynchronous calls on the consumer sideVersion 3.0.0 or later
referThreadNumreferThreadNumintoptionalperformance tuningthread pool size for asynchronous callsversion 3.0.0 or later
exportAsyncexportAsyncbooleanOptionalPerformance tuningWhether export is enabled on the serverVersion 3.0.0 or later
exportThreadNumexportThreadNumintoptionalasynchronous export thread pool sizeversion 3.0.0 or later

monitor

Monitoring center configuration. Corresponding configuration class: org.apache.dubbo.config.MonitorConfig

AttributeCorresponding URL parameterTypeRequiredDefault
protocolprotocolstringoptionaldubboservice governancemonitoring center protocol, if it is protocol=“registry”, it means that the address of the monitoring center is found from the registry, otherwise it is directly connected to the monitoring center.Version 2.0.9 and above
addressstringOptionalService GovernanceDirectly connected to the monitoring center server address, address=“10.20.130.230:12080”Version 1.0.16 or later
usernameusernamestringoptionalservice governancemonitoring center usernameversion 2.0.9 or later
passwordpasswordstringoptionalservice governancemonitoring center passwordversion 2.0.9 or later
groupgroupstringoptionalservice governancegroupingversion 2.0.9 or later
versionversionstringoptionalservice governanceversion numberversion 2.0.9 or later
intervalintervalstringoptionalservice governanceinterval timeversion 2.0.9 or later
parametersparametersMap<string, string>optionalcustom parametersversion 2.0.0 or later

method

Method-level configuration. Corresponding configuration class: org.apache.dubbo.config.MethodConfig. At the same time, this tag is a sub-tag of service or reference, which is used to control to the method level.

for example:

<dubbo:reference interface="com.xxx.XxxService">
   <dubbo:method name="findXxx" timeout="3000" retries="2" />
</dubbo:reference>
AttributeCorresponding URL parameterTypeRequiredDefault
namestringrequiredlogomethod nameversion 1.0.8 or later
timeout.timeoutintoptionaldefault is timeoutperformance tuningmethod call timeout (milliseconds)version 1.0.8 or later
retries.retriesintoptionalThe default is retries of dubbo:referencePerformance tuningThe number of retries for remote service calls, excluding the first call, please set it to 0Version 2.0.0 or higher
loadbalance.loadbalancestringoptionaldefault is loadbalanceperformance tuningload balancing strategy, optional values:
* random - random;
* roundrobin - polling ;
* leastactive - least active call;
* consistenthash - consistent hash (version 2.1.0+);
* shortestresponse - shortest response (version 2.7.7+);
2.0. Version 0 and above
async.asyncbooleanOptionalThe default is async of dubbo:referencePerformance tuningWhether to execute asynchronously, unreliable and asynchronous, just ignore the return value and not block the execution thread1.0.9 above version
sent.sentbooleanOptionaltruePerformance tuningWhen calling asynchronously, when the mark sent=true, it means that the network has sent dataVersion 2.0.6 or later
actives.activesintoptional0performance tuningmaximum concurrent call limit for each service consumerversion 2.0.5 or later
executes.executesintoptional0performance tuningthe maximum number of threads used per service and method - -, this attribute is only used when dubbo:method is used as a subtag of dubbo:service ValidVersion 2.0.5 and above
deprecated.deprecatedbooleanOptionalfalseService GovernanceWhether the service method is deprecated, this attribute is only valid when dubbo:method is used as a subtag of dubbo:serviceVersion above 2.0.5
sticky.stickybooleanoptionalfalseservice governanceset true All methods on this interface use the same provider. If you need more complex rules, please use routing2.0.6 or later
return.returnbooleanOptionaltruePerformance tuningWhether the method call needs to return a value. It will take effect only when async is set to true. If it is set to true, it will return future, or call back methods such as onreturn. If set to false, Null will be returned directly after the request is sent successfullyVersions above 2.0.6
oninvokeattribute attribute, not reflected in the URLStringOptionalPerformance tuningIntercept before instance executionVersion 2.0.6 or later
onreturnattribute attribute, not reflected in the URLStringOptionalPerformance tuningIntercept after instance execution returns
onthrowattribute attribute, not reflected in the URLStringoptionalperformance tuningexception interception in instance execution
oninvokeMethodattribute attribute, not reflected in the URLStringOptionalPerformance tuningIntercept before method executionVersion 2.0.6 or later
onreturnMethodattribute attribute, not reflected in the URLStringOptionalPerformance tuningIntercept after method execution returnsVersion above 2.0.6
onthrowMethodattribute attribute, not reflected in the URLStringOptionalPerformance tuningMethod execution has exception interceptionVersion 2.0.6 or later
cache.cachestring/booleanOptionalService GovernanceUse the call parameter as the key to cache the returned result, optional: lru, threadlocal, jcache, etc.Version above 2.1.0
validation.validationbooleanOptionalService GovernanceWhether to enable JSR303 standard annotation validation, if enabled, the annotations on method parameters will be validatedVersion 2.1.0 or later

argument

Method parameter configuration. Corresponding configuration class: org.apache.dubbo.config.ArgumentConfig. This tag is a sub-tag of method, which is used to describe the characteristics of method parameters, such as XML format:

<dubbo:method name="findXxx" timeout="3000" retries="2">
   <dubbo:argument index="0" callback="true" />
</dubbo:method>
AttributeCorresponding URL parameterTypeRequiredDefault
indexintrequiredidentifierparameter indexversion 2.0.6 or later
typeStringchoose one of index and indexidentificationfind parameter index by parameter typeversion 2.0.6 or later
callback.callbackbooleanoptionalservice governancewhether the parameter is a callback interface, if it is callback, the service provider will generate a reverse proxy, and the consumer can be reversely called from the service provider , usually used for event push.Versions above 2.0.6

parameter

Option parameter configuration. Corresponding configuration class: java.util.Map. At the same time, the label is a sub-label of protocol or service or provider or reference or consumer or monitor or registry or metadata-config or config-center, used for configuration Custom parameters, this configuration item will be used as an extension point to set custom parameters.

for example:

<dubbo:protocol name="napoli">
   <dubbo:parameter key="http://10.20.160.198/wiki/display/dubbo/napoli.queue.name" value="xxx" />
</dubbo:protocol>

You can also:

<dubbo:protocol name="jms" p:queue="xxx" />
AttributeCorresponding URL parameterTypeRequiredDefault
keykeystringRequiredService governanceRouting parameter keyVersion 2.0.0 or later
valuevaluestringRequiredService governanceRouting parameter valueVersion 2.0.0 or later

Environment variables

The supported keys are the following two:

  1. dubbo.labels, specify a list of key-value pairs configured in the URL, usually through JVM -D or system environment variables.

    Add the following configuration:

    # JVM
    -Ddubbo.labels = "tag1=value1; tag2=value2"
    # environment variables
    DUBBO_LABELS = "tag1=value1; tag2=value2"
    

    The final generated URL will contain two keys tag1 and tag2: dubbo://xxx?tag1=value1&tag2=value2

  2. dubbo.env.keys, specify the environment variable key value, Dubbo will try to load each key from the environment variable

    # JVM
    -Ddubbo.env.keys="DUBBO_TAG1, DUBBO_TAG2"
    # environment variables
    DUBBO_ENV_KEYS = "DUBBO_TAG1, DUBBO_TAG2"
    

    The final generated URL will contain two keys DUBBO_TAG1 and DUBBO_TAG2: dubbo://xxx?DUBBO_TAG1=value1&DUBBO_TAG2=value2

Other configuration

config-mode

background

Some types of configuration class instances can only appear once in each dubbo application (such as ApplicationConfig, MonitorConfig, MetricsConfig, SslConfig, ModuleConfig), and some can appear multiple times (such as RegistryConfig , ProtocolConfig, etc.).

If the application accidentally scans multiple unique configuration class instances (for example, the user misconfigures two ApplicationConfig in a dubbo application), which strategy should be used to deal with this situation? Is it throwing an exception directly? Is it to keep the former and ignore the latter? Is it to ignore the former and keep the latter? Or does it allow a certain form of coexistence (such as the attributes of the latter overriding the former)?

Currently, the only configuration class type in dubbo and the configuration modes/strategies allowed by finding multiple instances of a unique configuration type are as follows.

Unique configuration class type

ApplicationConfig, MonitorConfig, MetricsConfig, SslConfig, ModuleConfig.

The first four belong to the application level, and the last one belongs to the module level.

configuration mode

  • strict: Strict mode. Throw an exception directly.
  • override: override mode. Ignore the former and keep the latter.
  • ignore: ignore pattern. Ignore the latter and keep the former.
  • override_all: attribute override mode. No matter whether the attribute value of the former is empty or not, the attribute of the latter is overwritten/set on the former.
  • override_if_absent: attribute override mode if absent. Only when the corresponding attribute value of the former is empty, can the attribute of the latter be overwritten/set on the former.

Note: The latter two also affect property overrides for configuration instances. Because dubbo has multiple configuration methods, that is, there are multiple configuration sources, and the configuration sources also have priorities. For example, a ServiceConfig is configured through xml and the attribute version=1.0.0 is specified. At the same time, we configure dubbo.service.{interface}.version=2.0.0 in the external configuration (configuration center), Before the config-mode configuration item is introduced, according to the original configuration source priority, version=2.0.0 of the final instance. However, after the config-mode configuration item is introduced, the configuration priority rules are no longer so strict, that is, if config-mode is override_all is specified, it is version=2.0.0, if config-mode is override_if_absent If it is version=1.0.0, if config-mode is other values, the property setting/overwriting will follow the original configuration priority.

Configuration method

The configured key is dubbo.config.mode, the configured values are as described above, and the default policy value is strict. A sample configuration is shown below

# JVM -D
-Ddubbo.config.mode=strict

# environment variables
DUBBO_CONFIG_MODE=strict

# External configuration (configuration center), Environment of Spring application, dubbo.properties
dubbo.config.mode=strict
Last modified July 20, 2023: Update properties.md (e516025bed4)