Seata安装

一、下载

从Seata下载地址下载
https://github.com/seata/seata/releases
在这里插入图片描述

这里下载的是seata-server-1.5.2.tar.gz

解压:

tar -xvf seata-server-1.5.2.tar.gz

修改配置:conf/application.yml

server:
  port: 7091

spring:
  application:
    name: seata-server

logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash

console:
  user:
    username: seata
    password: seata

seata:
  config:
    # support: nacos, consul, apollo, zk, etcd3
    type: nacos
    # 配置中心地址
    nacos:
      server-addr: 127.0.0.1:8848
      # namespace:
      group: SEATA_GROUP
      username: nacos
      password: nacos
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key: ""
      #secret-key: ""
      data-id: seata-server.yaml
  registry:
    # support: nacos, eureka, redis, zk, consul, etcd3, sofa
    type: nacos
    #preferred-networks: *.*.*.*
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:8848
      group: SEATA_GROUP
      # 默认public
      # namespace:
      # 加入集群名称
      cluster: default
      username: nacos
      password: nacos
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key: ""
      #secret-key: ""
#  server:
#    service-port: 8091 #If not configured, the default is '${server.port} + 1000'
  security:
    secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
    tokenValidityInMilliseconds: 1800000
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login

二、MySQL配置

在MySQL8数据库中创建库表
安装步骤:https://blog.csdn.net/dreambyday/article/details/126022359

创建库、表、赋权

CREATE USER 'seata'@'%' IDENTIFIED BY 'seata';

create database IF NOT EXISTS seata;

GRANT ALL PRIVILEGES ON seata.* to 'seata'@'%'  with GRANT OPTION;

FLUSH PRIVILEGES;

在服务器seata/script/server/db/目录下找到mysql.sql脚本并执行,建立global_table,branch_table,lock_table,distributed_lock表

三、Nacos配置

nacos 里添加配置上面配置的

data-id: seata-server.yaml

group: SEATA_GROUP
在这里插入图片描述

修改数据库连接信息

store:
  mode: db
  lock:
    mode: db
  session:
    mode: db
  db:
    datasource: druid
    dbType: mysql
    # MySQL8的驱动
    driverClassName: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true
    user: seata
    password: seata
    minConn: 5
    maxConn: 30
    globalTable: global_table
    branchTable: branch_table
    distributedLockTable: distributed_lock
    queryLimit: 100
    lockTable: lock_table
    maxWait: 5000
server:
  recovery:
    committingRetryPeriod: 1000
    asynCommittingRetryPeriod: 1000
    rollbackingRetryPeriod: 1000
    timeoutRetryPeriod: 1000
  maxCommitRetryTimeout: -1
  maxRollbackRetryTimeout: -1
  rollbackRetryTimeoutUnlockEnable: false
  distributedLockExpireTime: 10000
  xaerNotaRetryTimeout: 60000
  session:
    branchAsyncQueueSize: 5000
    enableBranchAsyncRemove: false
  undo:
    logSaveDays: 7
    logDeletePeriod: 86400000
client:
  rm:
    asyncCommitBufferLimit: 10000
    lock:
      retryInterval: 10
      retryTimes: 30
      retryPolicyBranchRollbackOnConflict: true
    reportRetryCount: 5
    tableMetaCheckEnable: true
    tableMetaCheckerInterval: 60000
    sqlParserType: druid
    reportSuccessEnable: false
    sagaBranchRegisterEnable: false
    sagaJsonParser: fastjson
    tccActionInterceptorOrder: -2147482648
  tm:
    commitRetryCount: 5
    rollbackRetryCount: 5
    defaultGlobalTransactionTimeout: 60000
    degradeCheck: false
    degradeCheckAllowTimes: 10
    degradeCheckPeriod: 2000
    interceptorOrder: -2147482648
  undo:
    dataValidation: true
    logSerialization: jackson
    onlyCareUpdateColumns: true
    logTable: undo_log
    compress:
      enable: true
      type: zip
      threshold: 64k
tcc:
  fence:
    logTableName: tcc_fence_log
    cleanPeriod: 1h
log:
  exceptionRate: 100
metrics:
  enabled: false
  registryType: compact
  exporterList: prometheus
  exporterPrometheusPort: 9898
transport:
  type: TCP
  server: NIO
  heartbeat: true
  enableTmClientBatchSendRequest: false
  enableRmClientBatchSendRequest: true
  enableTcServerBatchSendResponse: false
  rpcRmRequestTimeout: 30000
  rpcTmRequestTimeout: 30000
  rpcTcRequestTimeout: 30000
  threadFactory:
    bossThreadPrefix: NettyBoss
    workerThreadPrefix: NettyServerNIOWorker
    serverExecutorThreadPrefix: NettyServerBizHandler
    shareBossWorker: false
    clientSelectorThreadPrefix: NettyClientSelector
    clientSelectorThreadSize: 1
    clientWorkerThreadPrefix: NettyClientWorkerThread
    bossThreadSize: 1
    workerThreadSize: default
  shutdown:
    wait: 3
  serialization: seata
  compressor: none

四、启动

启动
在bin目录下

sh seata-server.sh -p 8091 -h 127.0.0.1 -m db

查看启动日志,无报错即成功。

tail -200f 日志文件目录

在这里插入图片描述

访问服务
IP::7091/#/TransactionInfo
在这里插入图片描述

参考

  • Seata官网:http://seata.io/zh-cn/docs/user/quickstart.html
  • 安装参考1: https://blog.csdn.net/weixin_43036383/article/details/125765803
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值