SEATA事务服务DOCKER部署的过程详解
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-pseata4、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/h2/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到此这篇关于SEATA事务服务DOCKER部署的过程详解的文章就介绍到这了,更多相关seatadocker部署内容请搜索毛票票以前的文章或继续浏览下面的相关文章希望大家以后多多支持毛票票!
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。