这里使用的是seata-server-0.9.0
下载地址:http://seata.io/zh-cn/blog/download.html
首先分别将file.conf 、 registry.conf备份
接下来修改file.conf的部分内容
service部分
service {
##fsp_tx_group是自定义的
vgroup_mapping.my.test.tx_group="fsp_tx_group"
default.grouplist = "127.0.0.1:8091"
enableDegrade = false
disable = false
max.commitretry.timeout= "-1"
max.ollbackretry.timeout= "-1"
}
store部分
## transaction log store
store {
## store mode: file, db
## 改成db
mode = "db"
## file store
file {
dir = "sessionStore"
# branch session size, if exceeded first try compress lockkey, still exceeded throws exceptions
max-branch-session-size = 16384
# globe session size, if exceeded throws exceptions
max-global-session-size = 512
# file buffer size, if exceeded allocate new buffer
file-write-buffer-cache-size = 16384
# when recover batch read size
session.reload.read_size= 100
# async, sync
flush-disk-mode = async
}
# database store
db {
## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
datasource = "dbcp"
## mysql/oracle/h2/oceanbase etc.
## 配置数据源
db-type = "mysql"
driver-class-name = "com.mysql.jdbc.Driver"
url = "jdbc:mysql://127.0.0.1:3306/seata"
user = "root"
password = "你自己密码"
min-conn= 1
max-conn = 3
global.table = "global_table"
branch.table = "branch_table"
lock-table = "lock_table"
query-limit = 100
}
}
此处注意:!!!!
我使用的mysql版本是5.5,8.0以上版本驱动写法不一样
接着在mysql里新建一个seata库,导入sql脚本!!脚本在
然后修改 registry.conf
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
# 改用为nacos
type = "nacos"
nacos {
## 加端口号
serverAddr = "localhost:8848"
namespace = ""
cluster = "default"
}
...
}
在这里我们就配置完成了。
接着要先启动nacos!!!!再启动seata
还有一个小插曲,在启动seata的时候闪退了
原因是这里填写的nacos后面手多点了个空格
会出现这样的报错