createdatabase seata;use seata;CREATETABLEIFNOTEXISTS`global_table`(`xid`VARCHAR(128)NOTNULL,`transaction_id`BIGINT,`status`TINYINTNOTNULL,`application_id`VARCHAR(32),`transaction_service_group`VARCHAR(32),`transaction_name`VARCHAR(128),`timeout`INT,`begin_time`BIGINT,`application_data`VARCHAR(2000),`gmt_create`DATETIME,`gmt_modified`DATETIME,PRIMARYKEY(`xid`),KEY`idx_gmt_modified_status`(`gmt_modified`,`status`),KEY`idx_transaction_id`(`transaction_id`))ENGINE=InnoDBDEFAULTCHARSET= utf8;-- the table to store BranchSession dataCREATETABLEIFNOTEXISTS`branch_table`(`branch_id`BIGINTNOTNULL,`xid`VARCHAR(128)NOTNULL,`transaction_id`BIGINT,`resource_group_id`VARCHAR(32),`resource_id`VARCHAR(256),`branch_type`VARCHAR(8),`status`TINYINT,`client_id`VARCHAR(64),`application_data`VARCHAR(2000),`gmt_create`DATETIME(6),`gmt_modified`DATETIME(6),PRIMARYKEY(`branch_id`),KEY`idx_xid`(`xid`))ENGINE=InnoDBDEFAULTCHARSET= utf8;-- the table to store lock dataCREATETABLEIFNOTEXISTS`lock_table`(`row_key`VARCHAR(128)NOTNULL,`xid`VARCHAR(96),`transaction_id`BIGINT,`branch_id`BIGINTNOTNULL,`resource_id`VARCHAR(256),`table_name`VARCHAR(32),`pk`VARCHAR(36),`gmt_create`DATETIME,`gmt_modified`DATETIME,PRIMARYKEY(`row_key`),KEY`idx_branch_id`(`branch_id`))ENGINE=InnoDBDEFAULTCHARSET= utf8;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
二、准备seata的配置文件
1、创建对应的配置文件目录
mkdir /usr/local/docker/seata/
cd /usr/local/docker/seata/
vim resigtry.conf #(将下面的内容编辑到里面种去)
## transaction log store, only used in seata-server
store {## store mode: file、db、redis
mode ="db"## rsa decryption public key
publicKey =""## file store propertyfile{## store location dirdir="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
db {## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp)/HikariDataSource(hikari) etc.
datasource ="druid"## mysql/oracle/postgresql/h2/oceanbase etc.
dbType ="mysql"
driverClassName ="com.mysql.jdbc.Driver"## if using mysql to store the data, recommend add rewriteBatchedStatements=true in jdbc connection param
url ="jdbc:mysql://192.168.11.132:3306/seata?rewriteBatchedStatements=true"
user ="root"
password ="123456"
minConn =5
maxConn =100
globalTable ="global_table"
branchTable ="branch_table"
lockTable ="lock_table"
queryLimit =100
maxWait =5000}## redis store property
redis {## redis mode: single、sentinel
mode ="single"## single mode property
single {host="127.0.0.1"
port ="6379"}## sentinel mode property
sentinel {
masterName =""## such as "10.28.235.65:26379,10.28.235.65:26380,10.28.235.65:26381"
sentinelHosts =""}
password =""
database ="0"
minConn =1
maxConn =10
maxTotal =100
queryLimit =100}}