• 2024/4/22(分布式服务事务,CAP,BASE理论,Seata,微服务集成Seata,XA,AT,TCC.Saga,TC高可用,异地容灾)


    1. 配置内容如下:
    2. ```properties
    3. # 数据存储方式,db代表数据库
    4. store.mode=db
    5. store.db.datasource=druid
    6. store.db.dbType=mysql
    7. store.db.driverClassName=com.mysql.jdbc.Driver
    8. store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
    9. store.db.user=root
    10. store.db.password=123
    11. store.db.minConn=5
    12. store.db.maxConn=30
    13. store.db.globalTable=global_table
    14. store.db.branchTable=branch_table
    15. store.db.queryLimit=100
    16. store.db.lockTable=lock_table
    17. store.db.maxWait=5000
    18. # 事务、日志等配置
    19. server.recovery.committingRetryPeriod=1000
    20. server.recovery.asynCommittingRetryPeriod=1000
    21. server.recovery.rollbackingRetryPeriod=1000
    22. server.recovery.timeoutRetryPeriod=1000
    23. server.maxCommitRetryTimeout=-1
    24. server.maxRollbackRetryTimeout=-1
    25. server.rollbackRetryTimeoutUnlockEnable=false
    26. server.undo.logSaveDays=7
    27. server.undo.logDeletePeriod=86400000
    28. # 客户端与服务端传输方式
    29. transport.serialization=seata
    30. transport.compressor=none
    31. # 关闭metrics功能,提高性能
    32. metrics.enabled=false
    33. metrics.registryType=compact
    34. metrics.exporterList=prometheus
    35. metrics.exporterPrometheusPort=9898
    36. ```
    37. ==其中的数据库地址、用户名、密码都需要修改成你自己的数据库信息。==

     

    mysql8要在nacos控制台的数据库连接uri后加上ServerTimezone=Asia/Shanghai

    store.db.driverClassName=com.mysql.cj.jdbc.Driver改一下这个就行了

     

    1. registry {
    2. # tc服务的注册中心类,这里选择nacos,也可以是eureka、zookeeper等
    3. type = "nacos"
    4. nacos {
    5. # seata tc 服务注册到 nacos的服务名称,可以自定义
    6. application = "seata-tc-server"
    7. serverAddr = "127.0.0.1:8848"
    8. group = "DEFAULT_GROUP"
    9. namespace = ""
    10. cluster = "HZ"
    11. username = "nacos"
    12. password = "nacos"
    13. }
    14. }
    15. config {
    16. # 读取tc服务端的配置文件的方式,这里是从nacos配置中心读取,这样如果tc是集群,可以共享配置
    17. type = "nacos"
    18. # 配置nacos地址等信息
    19. nacos {
    20. serverAddr = "127.0.0.1:8848"
    21. namespace = ""
    22. group = "SEATA_GROUP"
    23. username = "nacos"
    24. password = "nacos"
    25. dataId = "seataServer.properties"
    26. }
    27. }

     

    1. # 事务组映射关系
    2. service.vgroupMapping.seata-demo=SH
    3. service.enableDegrade=false
    4. service.disableGlobalTransaction=false
    5. # 与TC服务的通信配置
    6. transport.type=TCP
    7. transport.server=NIO
    8. transport.heartbeat=true
    9. transport.enableClientBatchSendRequest=false
    10. transport.threadFactory.bossThreadPrefix=NettyBoss
    11. transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
    12. transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
    13. transport.threadFactory.shareBossWorker=false
    14. transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
    15. transport.threadFactory.clientSelectorThreadSize=1
    16. transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
    17. transport.threadFactory.bossThreadSize=1
    18. transport.threadFactory.workerThreadSize=default
    19. transport.shutdown.wait=3
    20. # RM配置
    21. client.rm.asyncCommitBufferLimit=10000
    22. client.rm.lock.retryInterval=10
    23. client.rm.lock.retryTimes=30
    24. client.rm.lock.retryPolicyBranchRollbackOnConflict=true
    25. client.rm.reportRetryCount=5
    26. client.rm.tableMetaCheckEnable=false
    27. client.rm.tableMetaCheckerInterval=60000
    28. client.rm.sqlParserType=druid
    29. client.rm.reportSuccessEnable=false
    30. client.rm.sagaBranchRegisterEnable=false
    31. # TM配置
    32. client.tm.commitRetryCount=5
    33. client.tm.rollbackRetryCount=5
    34. client.tm.defaultGlobalTransactionTimeout=60000
    35. client.tm.degradeCheck=false
    36. client.tm.degradeCheckAllowTimes=10
    37. client.tm.degradeCheckPeriod=2000
    38. # undo日志配置
    39. client.undo.dataValidation=true
    40. client.undo.logSerialization=jackson
    41. client.undo.onlyCareUpdateColumns=true
    42. client.undo.logTable=undo_log
    43. client.undo.compress.enable=true
    44. client.undo.compress.type=zip
    45. client.undo.compress.threshold=64k
    46. client.log.exceptionRate=100

     

  • 相关阅读:
    K8S一个Yaml执行多个任务
    阿里三面:MQ 消息丢失、重复、积压问题,怎么解决?
    【Linux operation 38】解决Linux 端口被占用
    在手机浏览器中打开指定的应用商店
    投资研报的优质网站
    阿里巴巴Java面试题、笔试题(含答案)
    提交Spark作业遇到的NoSuchMethodError问题
    C语言的缺陷与陷阱
    反射学习总结
    看起来是线程池的BUG,但是我认为是源码设计不合理。
  • 原文地址:https://blog.csdn.net/m0_64158084/article/details/137970855