- 配置内容如下:
-
- ```properties
- # 数据存储方式,db代表数据库
- store.mode=db
- store.db.datasource=druid
- store.db.dbType=mysql
- store.db.driverClassName=com.mysql.jdbc.Driver
- store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
- store.db.user=root
- store.db.password=123
- store.db.minConn=5
- store.db.maxConn=30
- store.db.globalTable=global_table
- store.db.branchTable=branch_table
- store.db.queryLimit=100
- store.db.lockTable=lock_table
- store.db.maxWait=5000
- # 事务、日志等配置
- server.recovery.committingRetryPeriod=1000
- server.recovery.asynCommittingRetryPeriod=1000
- server.recovery.rollbackingRetryPeriod=1000
- server.recovery.timeoutRetryPeriod=1000
- server.maxCommitRetryTimeout=-1
- server.maxRollbackRetryTimeout=-1
- server.rollbackRetryTimeoutUnlockEnable=false
- server.undo.logSaveDays=7
- server.undo.logDeletePeriod=86400000
-
- # 客户端与服务端传输方式
- transport.serialization=seata
- transport.compressor=none
- # 关闭metrics功能,提高性能
- metrics.enabled=false
- metrics.registryType=compact
- metrics.exporterList=prometheus
- metrics.exporterPrometheusPort=9898
- ```
-
-
-
- ==其中的数据库地址、用户名、密码都需要修改成你自己的数据库信息。==
-
mysql8要在nacos控制台的数据库连接uri后加上ServerTimezone=Asia/Shanghai
store.db.driverClassName=com.mysql.cj.jdbc.Driver改一下这个就行了
- registry {
- # tc服务的注册中心类,这里选择nacos,也可以是eureka、zookeeper等
- type = "nacos"
-
- nacos {
- # seata tc 服务注册到 nacos的服务名称,可以自定义
- application = "seata-tc-server"
- serverAddr = "127.0.0.1:8848"
- group = "DEFAULT_GROUP"
- namespace = ""
- cluster = "HZ"
- username = "nacos"
- password = "nacos"
- }
- }
-
- config {
- # 读取tc服务端的配置文件的方式,这里是从nacos配置中心读取,这样如果tc是集群,可以共享配置
- type = "nacos"
- # 配置nacos地址等信息
- nacos {
- serverAddr = "127.0.0.1:8848"
- namespace = ""
- group = "SEATA_GROUP"
- username = "nacos"
- password = "nacos"
- dataId = "seataServer.properties"
- }
- }
- # 事务组映射关系
- service.vgroupMapping.seata-demo=SH
-
- service.enableDegrade=false
- service.disableGlobalTransaction=false
- # 与TC服务的通信配置
- transport.type=TCP
- transport.server=NIO
- transport.heartbeat=true
- transport.enableClientBatchSendRequest=false
- transport.threadFactory.bossThreadPrefix=NettyBoss
- transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
- transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
- transport.threadFactory.shareBossWorker=false
- transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
- transport.threadFactory.clientSelectorThreadSize=1
- transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
- transport.threadFactory.bossThreadSize=1
- transport.threadFactory.workerThreadSize=default
- transport.shutdown.wait=3
- # RM配置
- client.rm.asyncCommitBufferLimit=10000
- client.rm.lock.retryInterval=10
- client.rm.lock.retryTimes=30
- client.rm.lock.retryPolicyBranchRollbackOnConflict=true
- client.rm.reportRetryCount=5
- client.rm.tableMetaCheckEnable=false
- client.rm.tableMetaCheckerInterval=60000
- client.rm.sqlParserType=druid
- client.rm.reportSuccessEnable=false
- client.rm.sagaBranchRegisterEnable=false
- # TM配置
- client.tm.commitRetryCount=5
- client.tm.rollbackRetryCount=5
- client.tm.defaultGlobalTransactionTimeout=60000
- client.tm.degradeCheck=false
- client.tm.degradeCheckAllowTimes=10
- client.tm.degradeCheckPeriod=2000
-
- # undo日志配置
- client.undo.dataValidation=true
- client.undo.logSerialization=jackson
- client.undo.onlyCareUpdateColumns=true
- client.undo.logTable=undo_log
- client.undo.compress.enable=true
- client.undo.compress.type=zip
- client.undo.compress.threshold=64k
- client.log.exceptionRate=100