Seata Server 环境搭建参考地址:
seata.io/zh-cn/docs/…
Server 端存储模式(store.mode)支持三种:
- file:单机模式,全局事务会话信息内存中读写并持久化本地文件root.data,性能较高
- db:高可用模式,全局事务会话信息通过db共享,相应性能差些
- redis:Seata-Server 1.3及以上版本支持,性能较高,存在事务信息丢失风险,请提前配置适合当前场景的redis持久化配置
github.com/seata/seata…
文章插图
client
存放client端sql脚本,参数配置
config-center
各个配置中心参数导入脚本,config.txt(包含server和client,原名nacos-config.txt)为通用参数文件
server
server端数据库脚本及各个容器配置
db存储模式 + Nacos(注册&配置中心)部署【Seata Server 环境搭建】步骤一:下载安装包 github.com/seata/seata…
文章插图
步骤二:建表(仅db模式) 全局事务会话信息由3块内容构成,全
局事务-->分支事务-->全局锁,对应表global_table、branch_table、lock_table 创建数据库seata,执行sql脚本,文件在
script/server/db/MySQL.sql(seata源码)中
-- -------------------------------- The script used when storeMode is 'db' ---------------------------------- the table to store GlobalSession dataCREATE TABLE IF NOT EXISTS `global_table`(`xid`VARCHAR(128) NOT NULL,`transaction_id`BIGINT,`status`TINYINTNOT 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 = InnoDBDEFAULT CHARSET = utf8;-- the table to store BranchSession dataCREATE TABLE IF NOT EXISTS `branch_table`(`branch_id`BIGINTNOT 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 = InnoDBDEFAULT CHARSET = utf8;-- the table to store lock dataCREATE TABLE IF NOT EXISTS `lock_table`(`row_key`VARCHAR(128) NOT NULL,`xid`VARCHAR(128),`transaction_id` BIGINT,`branch_id`BIGINTNOT 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 = InnoDBDEFAULT CHARSET = utf8;
步骤三:修改store.mode
启动包: seata-->conf-->file.conf,修改store.mode="db"
源码: 根目录-->seata-server-->resources-->file.conf,修改store.mode="db"
步骤四:修改数据库连接
启动包: seata-->conf-->file.conf,修改store.db相关属性 。
源码: 根目录-->seata-server-->resources-->file.conf,修改store.db相关属性 。
此时可以调到步骤七:直接启动Seata Server,注册中心和配置中心都是file
## transaction log store, only used in seata-serverstore {## store mode: file、db、redismode = "db"## rsa decryption public keypublicKey = ""## file store propertyfile {## store location dirdir = "sessionStore"# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptionsmaxBranchSessionSize = 16384# globe session size , if exceeded throws exceptionsmaxGlobalSessionSize = 512# file buffer size , if exceeded allocate new bufferfileWriteBufferCacheSize = 16384# when recover batch read sizesessionReloadReadSize = 100# async, syncflushDiskMode = async}## database store propertydb {## 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 paramurl = "jdbc:mysql://127.0.0.1:3306/seata?rewriteBatchedStatements=true"user = "root"password = "root123"minConn = 5maxConn = 100globalTable = "global_table"branchTable = "branch_table"lockTable = "lock_table"queryLimit = 100maxWait = 5000}## redis store propertyredis {## redis mode: single、sentinelmode = "single"## single mode propertysingle {host = "127.0.0.1"port = "6379"}## sentinel mode propertysentinel {masterName = ""## such as "10.28.235.65:26379,10.28.235.65:26380,10.28.235.65:26381"sentinelHosts = ""}password = ""database = "0"minConn = 1maxConn = 10maxTotal = 100queryLimit = 100}}
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 环境太吵对婴儿的影响
- 小说三要素是什么?
- 彩光嫩肤祛斑效果如何
- 为什么噪声也是污染?
- hr|95后打工人:“HR不用费心让我们融入公司环境,不想社交,真的拴Q”
- 程序员|推动职教与就业紧密结合 为航空职教发展营造良好环境
- 有关保护环境的古诗?关于保护环境古诗
- golang开发工具安装
- 环境|双倍好运!大理现巨大双彩虹 网友:美得不像话
- |史上最难就业季,毕业生该如何面对眼下的就业环境