您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“seata docker高可用部署是什么意思”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“seata docker高可用部署是什么意思”吧!
1.4.2
官方文檔
dockerhub
通過環(huán)境變量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
實(shí)現(xiàn)高可用需要依賴注冊(cè)中心,配置中心,數(shù)據(jù)庫(kù)
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配置,需要在對(duì)應(yīng)分組(SEATA_GROUP)下針對(duì)配置項(xiàng)目逐條配置文本值,而不是創(chuàng)建包含所有配置的properties文件,可以使用官方源碼中的腳本導(dǎo)入
全部可用配置參考
1. 使用數(shù)據(jù)庫(kù)
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
建庫(kù)腳本
-- -------------------------------- 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(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. 客戶端報(bào)錯(cuò) Data too long for column ‘a(chǎn)pplication_id'
io.seata.core.exception.TmTransactionException: TransactionException[begin global request failed. xid=null, msg=Data truncation: Data too long for column ‘a(chǎn)pplication_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數(shù)據(jù)庫(kù)global_table.application_id字段默認(rèn)長(zhǎng)度為varchar(32),如果客戶端應(yīng)用ID超長(zhǎng)則報(bào)此錯(cuò)
手動(dòng)修改字段類型增加長(zhǎng)度即可
到此,相信大家對(duì)“seata docker高可用部署是什么意思”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。