Seata 分布式事务服务器搭建
1. Seata 安装包下载
网址:https://github.com/seata/seata/releases
下载:seata-server-1.5.2.zip
2. Seata 配置文件修改
解压安装包,seata/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: file
registry:
# support: nacos, eureka, redis, zk, consul, etcd3, sofa
type: nacos
nacos:
application: seata-server
server-addr: 127.0.0.1:8848
namespace:
group: SEATA_GROUP
cluster: default
username: nacos
password: nacos
store:
# support: file 、 db 、 redis
mode: db
db:
datasource: druid
db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/seata?rewriteBatchedStatements=true
user: root
password: 123456
min-conn: 5
max-conn: 100
global-table: global_table
branch-table: branch_table
lock-table: lock_table
distributed-lock-table: distributed_lock
query-limit: 100
max-wait: 5000
# 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
注意:Seata 1.5 版本的 mysql 驱动是 5.7,如果你的数据库是 mysql8 则在
seata/libs
文件夹删除mysql-connector-java-5.xx.jar
,替换mysql-connector-java-8.xx.jar
即可
3. 创建 seata 数据库,执行脚本建表
通过 Navicat 工具新建 seata 数据库,然后执行 seata\script\server\db
文件夹下的 mysql.sql
脚本建表,如下:
4. 启动seata-server
双击 seata\bin\seata-server.bat
启动脚本,控制台如下:
5. 登录 seata
账号:seata
密码:seata
Seata 服务器搭建完成:)