小知识:SEATA事务服务DOCKER部署的过程详解

1、创库授权语句

?
1
2
> create database seata
> grant all on seata.* to seata_user@% identified by 123455

2、数据库建表语句

?
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
58
cat create_seata_table.sql
— ——————————– The script used when storeMode is db ——————————–
— the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS `global_table`
(
`xid`            VARCHAR(128) NOT NULL,
`transaction_id`      BIGINT,
`status`          TINYINT   NOT NULL,
`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,
PRIMARY KEY (`xid`),
KEY `idx_gmt_modified_status` (`gmt_modified`, `status`),
KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
— the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(
`branch_id`     BIGINT    NOT NULL,
`xid`        VARCHAR(128) NOT NULL,
`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),
PRIMARY KEY (`branch_id`),
KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;
— the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
`row_key`    VARCHAR(128) NOT NULL,
`xid`      VARCHAR(96),
`transaction_id` BIGINT,
`branch_id`   BIGINT    NOT NULL,
`resource_id`  VARCHAR(256),
`table_name`   VARCHAR(32),
`pk`       VARCHAR(36),
`gmt_create`   DATETIME,
`gmt_modified`  DATETIME,
PRIMARY KEY (`row_key`),
KEY `idx_branch_id` (`branch_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8;

 3、导入建表语句

?
1
mysql -useata_user -p seata < create_seata_table.sql

 4、FILE.CONF修改数据库连接信息

?
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
58
59
60
61
62
63
64
65
cat /home/seata-server/resources/file.conf
## transaction log store, only used in seata-server
store {
## store mode: file、db、redis
mode = “db”
## rsa decryption public key
publicKey = “”
## file store property
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
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.56.30:3306/seata?rewriteBatchedStatements=true” user = “seata_user”
password = “123455”
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
}
}

5、REGISTRY.CONF修改注册NACOS连接信息

?
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cat /home/seata-server/resources/registry.conf
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = “nacos”
loadBalance = “RandomLoadBalance”
loadBalanceVirtualNodes = 10
nacos {
application = “es-provider-seata”
serverAddr = “192.168.56.30:8848”
group = “DEFAULT_GROUP”
namespace = “”
cluster = “default”
username = “nacos”
password = “nacos”
}
eureka {
serviceUrl = “http://localhost:8761/eureka”
application = “default”
weight = “1”
}
redis {
serverAddr = “localhost:6379”
db = 0
password = “”
cluster = “default”
timeout = 0
}
zk {
cluster = “default”
serverAddr = “127.0.0.1:2181”
sessionTimeout = 6000
connectTimeout = 2000
username = “”
password = “”
}
consul {
cluster = “default”
serverAddr = “127.0.0.1:8500”
aclToken = “”
}
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”
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = “file”
nacos {
serverAddr = “127.0.0.1:8848”
namespace = “”
group = “SEATA_GROUP”
username = “”
password = “”
dataId = “seataServer.properties”
}
consul {
serverAddr = “127.0.0.1:8500”
aclToken = “”
}
apollo {
appId = “seata-server”
## apolloConfigService will cover apolloMeta
apolloMeta = “http://192.168.1.204:8801”
apolloConfigService = “http://192.168.1.204:8080”
namespace = “application”
apolloAccesskeySecret = “”
cluster = “seata”
}
zk {
serverAddr = “127.0.0.1:2181”
sessionTimeout = 6000
connectTimeout = 2000
username = “”
password = “”
}
etcd3 {
serverAddr = “http://localhost:2379”
}
file {
name = “file.conf”
}
}

6、DOCKER部署服务

?
1
2
3
4
5
docker run  –name seata-server-latest -p 8091:8091 \
-v /home/seata-server/resources/file.conf:/seata-server/resources/file.conf \
-v /home/seata-server/resources/registry.conf:/seata-server/resources/registry.conf \
-v /home/seata-server/logs:/root/logs \
seataio/seata-server:1.3.0

到此这篇关于SEATA事务服务DOCKER部署的过程详解的文章就介绍到这了,更多相关seata docker部署内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://www.cnblogs.com/faithH/p/14467484.html

声明: 猿站网有关资源均来自网络搜集与网友提供,任何涉及商业盈利目的的均不得使用,否则产生的一切后果将由您自己承担! 本平台资源仅供个人学习交流、测试使用 所有内容请在下载后24小时内删除,制止非法恶意传播,不对任何下载或转载者造成的危害负任何法律责任!也请大家支持、购置正版! 。本站一律禁止以任何方式发布或转载任何违法的相关信息访客发现请向站长举报,会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。本网站的资源部分来源于网络,如有侵权烦请发送邮件至:2697268773@qq.com进行处理。
建站知识

小知识:Docker镜像构建原理解析(不装docker也能构建镜像)

2023-3-24 13:15:15

建站知识

小知识:Docker+selenium实现自动化健康报备的方法

2023-3-24 13:30:02

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索