怎么在docker中部署一个seata事务服务-亚博电竞手机版

这期内容当中小编将会给大家带来有关怎么在docker中部署一个seata事务服务,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

1、创库授权语句

>createdatabaseseata; >grantallonseata.*toseata_user@'%'identifiedby'123455'

2、数据库建表语句

catcreate_seata_table.sql  ----------------------------------thescriptusedwhenstoremodeis'db'-------------------------------- --thetabletostoreglobalsessiondata 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=innodb defaultcharset=utf8;  --thetabletostorebranchsessiondata createtableifnotexists`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=innodb defaultcharset=utf8;  --thetabletostorelockdata createtableifnotexists`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=innodb defaultcharset=utf8;

3、导入建表语句

mysql-useata_user-pseata

4、file.conf修改数据库连接信息

cat/home/seata-server/resources/file.conf ##transactionlogstore,onlyusedinseata-server store{ ##storemode:file、db、redis mode="db" ##rsadecryptionpublickey publickey="" ##filestoreproperty file{ ##storelocationdir dir="sessionstore" #branchsessionsize,ifexceededfirsttrycompresslockkey,stillexceededthrowsexceptions maxbranchsessionsize=16384 #globesessionsize,ifexceededthrowsexceptions maxglobalsessionsize=512 #filebuffersize,ifexceededallocatenewbuffer filewritebuffercachesize=16384 #whenrecoverbatchreadsize sessionreloadreadsize=100 #async,sync flushdiskmode=async }  ##databasestoreproperty db{ ##theimplementofjavax.sql.datasource,suchasdruiddatasource(druid)/basicdatasource(dbcp)/hikaridatasource(hikari)etc. datasource="druid" ##mysql/oracle/postgresql/h3/oceanbaseetc. dbtype="mysql" driverclassname="com.mysql.jdbc.driver" ##ifusingmysqltostorethedata,recommendaddrewritebatchedstatements=trueinjdbcconnectionparam 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 }  ##redisstoreproperty redis{ ##redismode:single、sentinel mode="single" ##singlemodeproperty single{ host="127.0.0.1" port="6379" } ##sentinelmodeproperty sentinel{ mastername="" ##suchas"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连接信息

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" ##apolloconfigservicewillcoverapollometa 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部署服务

dockerrun--nameseata-server-latest-p8091: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

上述就是小编为大家分享的怎么在docker中部署一个seata事务服务了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注恰卡编程网行业资讯频道。

展开全文
内容来源于互联网和用户投稿,文章中一旦含有亚博电竞手机版的联系方式务必识别真假,本站仅做信息展示不承担任何相关责任,如有侵权或涉及法律问题请联系亚博电竞手机版删除

最新文章

网站地图