ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

seata的搭建与安装

2021-02-18 19:01:05  阅读:199  来源: 互联网

标签:group seata ## server file false 安装 搭建


seata1.3.0 服务端的搭建

1.从官网下载seata-server1.3.0

https://github.com/seata/seata/releases/tag/v1.3.0

2.下载以后conf目录有两个配置文件,一个是注册配置文件,另一个是file配置文件

注册配置文件用nacos的话,注意seata-server服务端与连接到该服务端的客户端是在一个group下面,否则客户端会报错无法从nacos注册服务器找到服务端。

 

 

 file配置文件

service {
  #transaction service group mapping
  vgroupMapping.fsp_tx_group = "default"
  default.grouplist = "127.0.0.1:8091"
  #degrade, current not support
  enableDegrade = false
  #disable seata
  disableGlobalTransaction = false
}

 注意默认事务组是fsp_tx_group,后续客户端连接事务组的时候也要是这个

    alibaba:
      seata:
        tx-service-group: fsp_tx_group

 客户端的file配置文件也要是一样的事务组名称

service {
  vgroupMapping.fsp_tx_group = "default" #修改自定义事务组名称
  default.grouplist = "127.0.0.1:8091"
  enableDegrade = false
  disable = false
  max.commit.retry.timeout = "-1"
  max.rollback.retry.timeout = "-1"
  disableGlobalTransaction = false
}

 file里面可以配置数据库

## transaction log store, only used in server side
store {
  ## store mode: file、db
  mode = "db"
  ## file store property
  file {
    ## store location dir
    dir = "sessionStore"
    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
    maxBranchSessionSize = 16384
    # globe session size , if exceeded throws exceptions
    maxGlobalSessionSize = 512
    # file buffer size , if exceeded allocate new buffer
    fileWriteBufferCacheSize = 16384
    # when recover batch read size
    sessionReloadReadSize = 100
    # async, sync
    flushDiskMode = async
  }

  ## database store property
  db {
    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc.
    datasource = "druid"
    ## mysql/oracle/postgresql/h2/oceanbase etc.
    dbType = "mysql"
    driverClassName = "com.mysql.jdbc.Driver"
    url = "jdbc:mysql://localhost:3306/seata"
    user = "root"
    password = "root"
    minConn = 5
    maxConn = 30
    globalTable = "global_table"
    branchTable = "branch_table"
    lockTable = "lock_table"
    queryLimit = 100
    maxWait = 5000
  }
}
## server configuration, only used in server side
server {
  recovery {
    #schedule committing retry period in milliseconds
    committingRetryPeriod = 1000
    #schedule asyn committing retry period in milliseconds
    asynCommittingRetryPeriod = 1000
    #schedule rollbacking retry period in milliseconds
    rollbackingRetryPeriod = 1000
    #schedule timeout retry period in milliseconds
    timeoutRetryPeriod = 1000
  }
  undo {
    logSaveDays = 7
    #schedule delete expired undo_log in milliseconds
    logDeletePeriod = 86400000
  }
  #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
  maxCommitRetryTimeout = "-1"
  maxRollbackRetryTimeout = "-1"
  rollbackRetryTimeoutUnlockEnable = false
}

## metrics configuration, only used in server side
metrics {
  enabled = false
  registryType = "compact"
  # multi exporters use comma divided
  exporterList = "prometheus"
  exporterPrometheusPort = 9898
}

同时搭建seata-server服务所依赖的数据库,global_tablesql,branch_table,lock_table语句见https://gitee.com/xiaoyinjun/seata-demo/blob/master/sql/seata.sql

配置好文件之后,启动脚本sh seata-server.sh -p 8091 -h  ******(绑定的ip地址)就可以执行了。

客户端代码示例见https://gitee.com/xiaoyinjun/seata-demo.git。如果按照以上搭建seata-server服务器,搭建客户端代码示例中所需要的数据库,建库语句在sql目录里面。就可以一键运行了。

seata官方文档见地址https://seata.io/zh-cn/docs/overview/what-is-seata.html

标签:group,seata,##,server,file,false,安装,搭建
来源: https://www.cnblogs.com/ykpkris/p/14413137.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有