seata1.1.0
seata-server
registy.conf
# 注册中心配置
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
# seata-server要注册到的注册中心类型
# 如果是file类型,客户端使用ip:port连接到seata-server
type = "consul"
nacos {
serverAddr = "localhost"
namespace = ""
cluster = "default"
}
eureka {
serviceUrl = "http://localhost:8761/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "seata-server"
serverAddr = "127.0.0.1:8500"
}
etcd3 {
cluster = "default"
serverAddr = "http://localhost:2379"
}
sofa {
serverAddr = "127.0.0.1:9603"
application = "default"
region = "DEFAULT_ZONE"
datacenter = "DefaultDataCenter"
cluster = "default"
group = "SEATA_GROUP"
addressWaitTime = "3000"
}
file {
name = "file.conf"
}
}
# seata-server配置中心
config {
# file、nacos 、apollo、zk、consul、etcd3
# 配置中心类型,从配置中心获取server的配置参数
# 如果type=file,则从本地file.conf中获取配置参数
type = "consul"
nacos {
serverAddr = "localhost"
namespace = ""
group = "SEATA_GROUP"
}
consul {
serverAddr = "127.0.0.1:8500"
}
apollo {
app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801"
namespace = "application"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
etcd3 {
serverAddr = "http://localhost:2379"
}
file {
name = "file.conf"
}
}
file.conf
当registy.conf中config.type=file时,才加载file.conf中的配置参数.
如果config.type=其它注册中心值时,就不需要配置file.conf了
## transaction log store, only used in seata-server
store {
## store mode: file、db
# 事务会话信息存储方式,file不支持高可用,db支持高可用
mode = "file"
## file store property
# mode=file时加载的参数
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
# mode=db时加载的参数
db {
## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
datasource = "dbcp"
## mysql/oracle/h2/oceanbase etc.
dbType = "mysql"
driverClassName = "com.mysql.jdbc.Driver"
url = "jdbc:mysql://127.0.0.1:3306/seata"
user = "mysql"
password = "mysql"
minConn = 1
maxConn = 10
# 全局事务表名
globalTable = "global_table"
# 分支事务表名
branchTable = "branch_table"
# 全局锁表名
lockTable = "lock_table"
queryLimit = 100
}
}
配置高可用需要在配置的数据库中添加3张表
-- the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS `global_table`
(
`xid` VARCHA