说明

https://seata.io/zh-cn/docs/ops/deploy-guide-beginner.html
Server端存储模式(store.mode)支持三种:

  • file:单机模式,全局事务会话信息内存中读写并持久化本地文件root.data,性能较高
  • db:高可用模式,全局事务会话信息通过db共享,相应性能差些
  • redis:Seata-Server 1.3及以上版本支持,性能较高,存在事务信息丢失风险,请提前配置适合当前场景的redis持久化配置

资源目录:https://github.com/seata/seata/tree/1.4.0/script

  • client

存放client端sql脚本,参数配置

  • config-center

各个配置中心参数导入脚本,config.txt(包含server和client,原名nacos-config.txt)为通用参数文件

  • server

server端数据库脚本及各个容器配置

下载Seata安装包并且上传到linux上解压

访问: https://github.com/seata/seata/releases

image.png
根据情况下载,我这里是往linux上部署,所以直接下载tar.gz包,然后放到linux上解压

另外还需要下载Source code(zip) , Seata的MySQL脚本在这个里面

  1. [root@zjj101 seata]# pwd
  2. /root/soft/seata
  3. [root@zjj101 seata]# ls
  4. bin conf lib LICENSE logs

建表

全局事务会话信息由3块内容构成,全局事务—>分支事务—>全局锁,对应表global_table、branch_table、lock_table

接着打开在上面的步骤中下载的 Source code(zip)

image.png

创建数据库seata,执行sql脚本,文件在script/server/db/mysql.sql(seata源码)中

  1. CREATE DATABASE seata;
  2. use seata;

执行结果
image.png

修改配置文件

配置nacos注册中心和配置中心

将Seata Server注册到Nacos,修改conf目录下的registry.conf配置 “seata/conf/registry.conf”

大概在第三行的位置
image.png

大概在56行的位置
image.png

注意:如果配置了seata server使用nacos作为配置中心,则配置信息会从nacos读取,file.conf可以不用配置。 客户端配置registry.conf

使用nacos时也要注意group要和seata server中的group一致,默认group是”DEFAULT_GROUP”

将seata配置导入到nacos上

如果配置了seata server使用nacos作为配置中心,则配置信息会从nacos读取,file.conf可以不用配置。 客户端配置registry.conf

具体操作步骤查看:
https://www.yuque.com/docs/share/d13e525b-1e1b-4a42-8907-e0c9e7e00acb?# 《将seata默认配置导入到nacos配置列表中》

启动SeataServer

命令启动: 在seata根目录下执行: bin/seata-server.sh -h zjj101 -p 8091

后台启动seata方式命令: 在bin目录下执行:

  1. nohup sh seata-server.sh -h zjj101 -p 8091 -m file >nohup.out 2>1 &

image.png