我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

seatadocker高可用部署的详细介绍

版本

网站建设哪家好,找成都创新互联公司!专注于网页设计、网站建设、微信开发、小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了白银免费建站欢迎大家使用!

1.4.2

启动

通过环境变量SEATA_CONFIG_NAME指定配置文件位置/root/seata-config/registry.conf

docker run --name seata-server \ -p 8091:8091 \ -e SEATA_CONFIG_NAME=file:/root/seata-config/registry \ -v /User/seata/config:/root/seata-config \ seataio/seata-server配置文件
实现高可用需要依赖注册中心,配置中心,数据库

registry.conf

registry { type = "nacos" nacos { application = "seata-server" serverAddr = "192.168.199.2" namespace = "test" group = "SEATA_GROUP" cluster = "default" username = "" password = "" }}config { type = "nacos" nacos { serverAddr = "192.168.199.2" namespace = "test" group = "SEATA_GROUP" username = "" password = "" }}NACOS配置
注:使用nacos配置,需要在对应分组(SEATA_GROUP)下针对配置项目逐条配置文本值,而不是创建包含所有配置的properties文件,可以使用官方源码中的

全部可用配置

1. 使用数据库
store.mode=db
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://192.168.199.2:3306/seata?useUnicode=true&rewriteBatchedStatements=true
store.db.user=root

store.db.password=123456

创建数据库-- -------------------------------- 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` 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 dataCREATE 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 dataCREATE TABLE IF NOT EXISTS `lock_table`( `row_key` VARCHAR(128) NOT NULL, `xid` VARCHAR(128), `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;异常处理

1. 客户端报错 Data too long for column ‘application_id'
io.seata.core.exception.TmTransactionException: TransactionException[begin global request failed. xid=null, msg=Data truncation: Data too long for column ‘application_id' at row 1]
at io.seata.tm.DefaultTransactionManager.begin(DefaultTransactionManager.java:55) ~[seata-all-1.3.0.jar:1.3.0]
at io.seata.tm.api.DefaultGlobalTransaction.begin(DefaultGlobalTransaction.java:104) ~[seata-all-1.3.0.jar:1.3.0]

at io.seata.tm.api.TransactionalTemplate.beginTransaction(TransactionalTemplate.java:175) ~[seata-all-1.3.0.jar:1.3.0]
seata数据库global_table.application_id字段默认长度为varchar(32),如果客户端应用ID超长则报此错

手动修改字段类型增加长度即可

到此这篇关于seata docker 高可用部署的文章就介绍到这了,更多相关seata docker部署内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!


网站标题:seatadocker高可用部署的详细介绍
网页链接:http://mswzjz.cn/article/ehpcci.html

其他资讯