Skip to main content
Version: v1.4

The Seata Parameter Configuration

Attention attribute (see all attributes for detailed description)

Server sideclient side
#store.mode=db requires the following* test* tx_ group
store.db.driverClassNameservice.default. grouplist
store.db.urlservice. disableGlobalTransaction
#store.mode=Redis requires the following configurations

All attributes

Public sector

keydescremarkchange record
transport.typeSocket communication modeTCP, UNIX* DOMAIN* SOCKET, default TCP
transport.serversocket channel typeNIO, NATIVE (select KQueue or Epoll according to the operating system type and socket communication mode. Note that Windows only supports NIO, and NATIVE mode will throw an exception)
transport.threadFactory. bossThreadSizeNetty communication model Boss group threadsDefault 1
transport.threadFactory. workerThreadSizeNetty communication model Worker group threadsThe number of threads can be configured or the number of threads in a specific thread working mode can be selected. There are four default working modes of threads: Auto (2 _ CPU cores+1), Pin (CPU cores, applicable to computing intensive tasks), BusyPin (CPU cores+1, applicable to computing intensive and memory limited scenarios) Default (2 _ CPU cores, applicable to IO intensive tasks), the default value is Default mode
transport.shutdown. waitTime to wait for service offline before the Netty thread pool on the server is closed3 seconds by default
transport.serializationClient and server communication codec methodseata (ByteBuf), protobuf, kryo, hessian, fst, default seata
transport.compressorCompression method of communication data between client and servernone, gzip, zip, sevenz, bzip2, lz4, deflater(1.4.1), default none
transport.heartbeatThe heartbeat detection switch for client server communicationThe default value is true
Registry.typeRegistry typeDefault file, supports file, nacos, redis, eureka, zk, consumer, etcd3, sofa, and custom
Config.typeConfiguration center typedefault file, supporting file, nacos, apollo, zk, consult, etcd3, springcloud, custom

Server side

keydescremarkchange record
server.undo.logSaveDaysundo retention days7 days by default, log_ Status=1 (Appendix 3) and undo not normally cleaned
server.undo.logDeletePeriodundo Cleanup Thread Interval86,400,000 by default, in milliseconds
server.maxCommitRetryTimeoutTimeout duration of two-phase commit retryUnit: ms, s, m, h, d, corresponding to ms, s, min, h, day, default ms. The default value of - 1 means unlimited retries. Formula: timeout>=now globalTransactionBeginTime, true means no more retries after timeout (Note: no retries will be made after the timeout is reached, and there is a risk of data inconsistency, unless the business can calibrate the data itself, otherwise use with caution)
server.maxRollbackRetryTimeoutPhase2 rollback retry timeout durationSame as commit
server.recovery.committingRetryPeriodPhase2 commit unfinished status Global transaction retry commit thread interval1000 by default, in milliseconds
server.recovery.asyncCommittingRetryPeriodPhase2 asynchronous submission status Retry submission thread interval1000 by default, in milliseconds
server.recovery.rollbackRetryPeriodPhase2 rollback status Retry rollback thread interval1000 by default, in milliseconds
server.recovery.timeoutRetryPeriodTimeout status detection retry thread interval1000 by default, in milliseconds. If timeout is detected, put the global transaction into the rollback session manager
server.rollbackRetryTimeoutUnlockEnableWhether to release the lock after the two-phase rollback timeoutFalse by default
store.modeTransaction session information storage modefile Local file (HA is not supported), db database, redis (HA is supported)
store.publicKeyPublic key for storing and decrypting passwords in db or Redissupported in version 1.4.2
store.file.dirfile mode file storage folder namedefault sessionStore
store.file.maxBranchSessionSizeFile mode file storage branch session maximum bytes16384 (16kb) by default, in bytes
store.file.maxGlobalSessionSizeFile mode file stores the maximum number of global session bytes512b by default, in bytes
store.file.fileWriteBufferCacheSizeFile mode file storage buffer maximum cache size16384 (16kb) by default, in bytes. When the amount of data such as session written is greater than this value, an exception will be thrown
store.file.flushDiskModefile mode file storage flushing policydefault async, optional sync
store.file.sessionReloadReadSizeFile mode File storage The maximum number of session or lock keys recovered from the backup file after the server node restarts100 by default
store.db.datasourcedb mode data source typedbcp, druid, hikari; No default value, store Must be specified when mode=db
store.db.dbTypedb mode database typemysql, oracle, db2, sqlserver, sybaee, h2, sqlite, access, postgresql, oceanbase; No default value, store Mode=db must be specified
store.db.driverClassNamedb mode database driverstore Must be specified when mode=db
store.db.urldb mode database urlstore When mode=db, it must be specified. When using MySQL as the data source, it is recommended to add 'rewriteBatchedStatements=true' to the connection parameters (see Appendix 7 for detailed reasons)
store.db.userdb mode database accountstore Must be specified when mode=db
store.db.passworddb mode database account passwordstore Must be specified when mode=db
store.db.minConninitial connections of db mode database1 by default
store.db.maxConnmaximum number of connections to database in db mode20 by default
store.db.maxWaitthe maximum waiting time for db mode to obtain a connection5000 by default, in milliseconds
store.db.globalTabledb mode global transaction table namedefault global_ table
store.db.branchTabledb mode branch transaction table namedefault branch_ table
store.db.LockTabledb mode global lock table namedefault lock_ table
store.db.queryLimitthe maximum number of global transactions queried in db mode at one time100 by default
store.redis.moderedis modedefault single, optional sentinelNew sentinel mode in 1.4.2
store.redis.single.hostThe Redis host in stand-alone mode is compatible with versions earlier than 1.4.2. If this configuration is empty, select store.redis Host as a configuration itemNew in 1.4.2
store.redis.single.portThe port of Redis in stand-alone mode is compatible with versions earlier than 1.4.2. If this configuration is empty, select store.redis Port as a configuration itemNew in 1.4.2
store.redis.sentinel.masterNameRedis master database name in sentinel modeNew in 1.4.2
store.redis.sentinel.sentinelHostssentinel hosts in sentinel modeMultiple hosts are separated by commasNew in 1.4.2
store.redis.hostredis mode IPDefault 1.4.2 deprecated
store.redis.portredis mode port6379 by defaultVersion 1.4.2 is deprecated
store.redis.maxConnmaximum connections in Redis mode10 by default
store.redis.minConnminimum connections in Redis mode1 by default
store.redis.databaseredis mode default librarydefault 0
store.redis.passwordredis mode password (optional)null by default
store.redis.queryLimitThe maximum number of Redis queries at a time100 by default
metrics.enabledWhether to enable MetricsFalse is off by default. In the false state, all Metrics related components will not be initialized to minimize the performance loss
metrics.registryTypeIndicator registrar typeThe indicator registrar type used by Metrics is a built-in compact (simple) implementation by default. Meters in this implementation only use a limited memory count, and the performance is high enough to meet most scenarios; Currently, only one indicator registrar can be set
metrics.exporterListIndex result Measurement data outputter listdefault prometheus. Multiple outputters are separated by English commas, such as "prometheus, jmx". Currently, only the prometheus outputters are connected
metrics.exporterPrometheusPortprometheus exporter client port number9898 by default

Client side

keydescremarkchange record
seata.enabledwhether to enable spring boot automatic assemblytrue, false, (SSBS) special configuration, default true (Appendix 4)
seata.enableAutoDataSourceProxy=truewhether to enable automatic proxy of data sourceTrue, false, data spring boot starter (SSBS) is a special configuration. SSBS will enable automatic proxy of data source by default and can be closed through this configuration item
seata.useJdkProxy=falsewhether to use JDK proxy as the implementation method of data source automatic proxytrue, false, (SSBS) proprietary configuration, false by default, CGLIB as the implementation method of data source automatic proxy
transport.enableClientBatchSendRequestwhether to batch merge and send client transaction message requestsThe default is true and false
client.log.exceptionRatelog exception output probability100 by default, currently used for exception stack output in case of undo rollback failure, 1% probability output, rollback failure is basically dirty data, no need to output stack to occupy hard disk space
service.vgroupMapping.my_test_tx_Grouptransaction group (Appendix 1)my* test* tx_ Group refers to grouping, and the configuration item value is TC cluster name
service.default.grouplistTC service list (Appendix 2)Only used when the registry is file
service.disableGlobalTransactionglobal transaction switchFalse by default. false is on, true is off switchFalse by default. The business side automatically downgrades the seata transaction based on the number of consecutive errors (see Appendix 6 for details) value for reaching the standard of promotion and demotion10 by default self check cycle2000 by default, in ms Conduct a service self check every 2 seconds to decide
client.rm.reportSuccessEnablewhether to report phase I successTrue, false, starting from version 1.1.0. The default is false true is used to keep the life cycle records of branch transactions complete. false can improve performance
client.rm.asyncCommitBufferLimitasynchronous commit cache queue length10000 by default. Phase II commit succeeded. RM asynchronously cleans the undo queue
client.rm.lock.retryIntervalretry interval for verifying or occupying the global lock10 by default, in milliseconds
client.rm.lock.retryTimesnumber of retries to verify or occupy the global lock30 by default
client.rm.lock.retryPolicyBranchRollbackOnConflictthe lock policy when a branch transaction conflicts with other global rollback transactionsThe default is true. Release the local lock first to allow rollback to succeed
client.rm.reportRetryCountthe number of TC retries for reporting the results in the first phase5 by defaultNew in 1.4.1
client.rm.tableMetaCheckerIntervalinterval between scheduled refreshing of table structures in cache60 seconds by default
client.rm.sagaBranchRegisterEnablewhether to enable saga branch registrationIn Saga mode, the branch state is stored in the local database of the state machine and can be submitted or rolled back through the state machine. To improve performance, you can consider not registering Saga branches with the TC, but you need to consider the availability of the state machine. The default is false number of TC retries for reporting the results of the first phase global submission1 by default, it is recommended to be greater than 1 number of TC retries reported for the global rollback results in the first phase1 by default, it is recommended to be greater than 1 transaction timeoutThe default is 60 seconds. After TM detects a branch transaction timeout or TC detects that TM has not made a two-phase report timeout, it initiates a rollback of the branch transactionNew in 1.4.0
client.undo.dataValidationPhase2 rollback image verificationBy default, true is enabled and false is disabled
client.undo.logSerializationundo serialization methoddefault jackson
client.undo.logTableuser defined undo table nameDefault undo_ log
client.undo.onlyCareUpdateColumnsonly images of updated columns are generatedDefault true
client.undo.compress.enableundo log compression switchdefault trueNew in 1.4.1
client.undo.compress.typeundo log compression algorithmDefault zip. Options include NONE, GZIP, ZIP, SEVENZ, BZIP2, LZ4, DEFLATER, and ZSTDNew in 1.4.1
client.undo.compress.thresholdundo log compression thresholdThe default value is 64k. Compression occurs when the compression switch is on and the undo log size exceeds the threshold valueNew in 1.4.1
client.rm.sqlParserTypesql resolution typedefault druid, optional antlr
synchronize parameters to the configuration center for use demo



sh $\{SEATAPATH}/script/config-center/nacos/ -h localhost -p 8848 -g SEATA_GROUP -t 5a3c7d6c-f497-4d68-a71a-2e5e3340b3ca

Parameter description:

-h: Host, the default is localhost

-p: Port, default 8848

-g: Configure grouping. The default value is' SEATA_ GROUP'

-t: Tenant information, corresponding to the namespace ID field of Nacos, the default value is null ''


sh $\{SEATAPATH}/script/config-center/apollo/ -h localhost -p 8070 -e DEV -a seata-server -c default -n application -d apollo -r apollo -t 3aa026fc8435d0fc4505b345b8fa4578fb646a2c

Parameter description:

-h: Host, the default is localhost

-p: Port, the default value is 8070

-e: Managed configuration environment, default value DEV

-a: AppId of the Namespace. The default value is seata server

-c: The name of the managed configuration cluster is generally passed in as default. If it is a special cluster, just pass in the name of the corresponding cluster. The default value is default

-n: The name of the namespace under management. If it is not in the properties format, it needs to add a suffix, such as sample.yml. The default value is application

-d: The creator of the item, in the format of domain account, that is, the user ID of the sso system

-r: Publisher, domain account. Note: If the namespace. lock. switch in Apollo ConfigDB. ServerConfig is set to true (false by default), the environment does not allow the publisher and editor to be the same person. So if the editor is zhangsan, the publisher can no longer be zhangsan.

-t: The Apollo administrator creates a third-party application at http://{portal_address}/open/manage.html. Before creating it, it is better to query whether the AppId has been created. After successful creation, a token will be generated

For details of the above parameters, see:


sh $\{SEATAPATH}/script/config-center/consul/ -h localhost -p 8500

Parameter description:

-h: host, the default is localhost

-p: port, the default value is 8500


sh $\{SEATAPATH}/script/config-center/etcd3/ -h localhost -p 2379

Parameter description:

-h: Host, the default is localhost

-p: Port, the default value is 2379


python $\{SEATAPATH}/script/config-center/nacos/ localhost:8848


sh $\{SEATAPATH}/script/config-center/zk/ -h localhost -p 2181 -z "/Users/zhangchenghui/zookeeper-3.4.14"

Parameter description:

-h: host, the default is localhost

-p: port, the default value is 2181

-z: zk path

Appendix 1:

Description of transaction grouping.

  1. What is a transaction group?

Transaction grouping is the resource logic of seata, similar to service instance. My in file.conf* test* tx_ A group is a transaction group.

  1. How to find the back-end cluster through transaction grouping?

First, the program configures transaction grouping (txServiceGroup parameter of GlobalTransactionScanner construction method). The program will search for service.vgroupMapping through the user configured configuration center

Transaction grouping configuration item. The value of the configuration item obtained is the name of the TC cluster. The program that obtains the cluster name constructs the service name through a certain prefix+cluster name. The service name of each configuration center is different. Get the service name, go to the corresponding registry, pull the service list of the corresponding service name, and get the real TC service list of the back-end.

  1. Why is the design so that the service name is not directly taken?

There is an additional layer to obtain the configuration of transaction groups to the mapping cluster. After this design, the transaction group can be used as the logical isolation unit of resources, which can quickly fail over when a failure occurs.

Appendix 2:

About the grouplist question.

  1. When will the default.grouplist in file.conf be used?

It is used when registry.type=file. It is not read in other times.

  1. Can multiple value lists be configured for default.grouplist?

Multiple can be configured, which means cluster, but when store When mode=file, an error will be reported. The reason is that the file storage mode does not provide synchronization of local files, so you need to use store.mode=db to share data between TC clusters through db

  1. Is default.grouplist recommended?

Not recommended. For example, question 1, when registering It is used when type=file, which means that the real registry is not used here, and the health check mechanism without specific services cannot automatically remove the list when the tc is unavailable. It is recommended to use nacos, eureka, redis, zk, consumer, etcd3, and sofa. Registry. type=file or config The original purpose of type=file design is to enable users to quickly verify the seata service through direct connection without relying on a third-party registry or configuration center.

  1. Why is the configuration in seata spring boot starter grouplist.default, that is, the default in file.conf Is the writing of grouplist just reversed?

Due to the syntax requirements of the spring boot configuration file itself, the default.grouplist in file.conf needs to be written as grouplist.default in this place. The effect is the same

Appendix 3:

log_ Status=1 is defensive. It is a global rollback request received, but it is uncertain whether the local transaction of a transaction branch has been executed. At this time, a piece of data with the same branch ID is inserted in advance, and the inserted false data is successful. If the local transaction continues to execute, the only index conflict will be reported for automatic rollback.

If the insertion is unsuccessful, it indicates that the local transaction has been completed, and the undo data is taken out for reverse rollback.

Appendix 4:

Whether to enable spring boot automatic assembly. If it is enabled, the integration of seata and spring boot will be automatically configured, including the automatic proxy of data source and initialization of GlobalTransactionScanner.

Note: New features of version 1.0 need to rely on seata spring boot starter.

Appendix 5:

The following annotations have been added to seata 1.1.0 to enable the automatic proxy function of data sources



|UseJdkProxy | Whether to use JDK proxy as the implementation method of data source automatic proxy | false, true, false by default, CGLIB as the implementation method of data source automatic proxy|

  1. For the method of using seata spring boot starter, the data source automatic proxy is enabled by default. If you need to close it, please configure seata. enableAutoDataSourceProxy=false, which is true by default.

To switch the proxy implementation mode, please click seata UseJdkProxy=false. The default value is false. CGLIB is used as the implementation method of automatic proxy for data sources.

  1. For the method of using seata all, please use @ EnableAutoDataSourceProxy to explicitly enable the automatic proxy function of the data source. If necessary, you can use the useJdkProxy attribute of the annotation to implement the proxy

Switch of. The default value is false. CGLIB is used as the implementation method of automatic proxy for data sources.

Appendix 6:

Introduction to the implementation of automatic service degradation policy:

First, decide whether to start the self-test thread by reading whether is true. Then read degradeCheckAllowTimes and degradeCheckPeriod to confirm the threshold value and self-test cycle

Assume that degradeCheckAllowTimes=10, and degradeCheckPeriod=2000

Then a start and commit test will be performed every 2 seconds. If it fails, the number of consecutive failures will be recorded. If it succeeds, the number of consecutive failures will be cleared The continuous errors are accumulated by the user interface and the self checking thread until the number of continuous failures reaches the user's threshold, then the Seata distributed transaction is closed to avoid the user's own business being unavailable for a long time

On the contrary, if the current distributed transaction is closed, the self-test thread will continue to perform the self-test every 2 seconds until the number of consecutive successes reaches the threshold set by the user, then the Seata distributed transaction will be restored to use

Appendix 7:

In the store mode=db. Because seata inserts global locks in batches through the executeBatch of jdbc, according to the MySQL official website, when the rewriteBatchedStatements in the connection parameter is true, when executeBatch is executed and the operation type is insert, the jdbc driver will optimize the corresponding SQL to the form of 'insert into () values (), ()' to improve the performance of batch insert.

According to the actual test, when this parameter is set to true, the corresponding batch insert performance is more than 10 times of the original. Therefore, it is recommended to set this parameter to true when the data source is MySQL.