专门做照片书的网站,门户网站cms系统,wordpress 团购主题,建e网模型下载目录 一、版本说明 二、建立Seata Server数据库#xff08;TC-带头大哥的数据库#xff09;
三、业务库建表 四、安装Seata-Server 4.1 虚拟机里新建一个/opt/seate/seata-server文件夹#xff0c;在seate文件夹下新建一个docker-compose.yml 文件
4.2 运行容器
4.3 在na…目录 一、版本说明 二、建立Seata Server数据库TC-带头大哥的数据库
三、业务库建表 四、安装Seata-Server 4.1 虚拟机里新建一个/opt/seate/seata-server文件夹在seate文件夹下新建一个docker-compose.yml 文件
4.2 运行容器
4.3 在nacos里配置seata的相关信息
4.4 启动 一、版本说明
https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E 二、建立Seata Server数据库TC-带头大哥的数据库
https://github.com/apache/incubator-seata/tree/v1.6.1/script/server/db 三、业务库建表
在订单业务数据库和库存业务数据库里分别添加下表
https://github.com/apache/incubator-seata/blob/v1.6.1/script/client/at/db/mysql.sql
-- for AT mode you must to init this sql for you business database. the seata server not need it.
CREATE TABLE IF NOT EXISTS undo_log
(branch_id BIGINT NOT NULL COMMENT branch transaction id,xid VARCHAR(128) NOT NULL COMMENT global transaction id,context VARCHAR(128) NOT NULL COMMENT undo_log context,such as serialization,rollback_info LONGBLOB NOT NULL COMMENT rollback info,log_status INT(11) NOT NULL COMMENT 0:normal status,1:defense status,log_created DATETIME(6) NOT NULL COMMENT create datetime,log_modified DATETIME(6) NOT NULL COMMENT modify datetime,UNIQUE KEY ux_undo_log (xid, branch_id)
) ENGINE InnoDBAUTO_INCREMENT 1DEFAULT CHARSET utf8mb4 COMMENT AT transaction mode undo table; 四、安装Seata-Server
参考https://seata.apache.org/zh-cn/docs/v1.6/ops/deploy-by-docker-compose/#nacos%E6%B3%A8%E5%86%8C%E4%B8%AD%E5%BF%83db%E5%AD%98%E5%82%A8 4.1 虚拟机里新建一个/opt/seate/seata-server文件夹在seate文件夹下新建一个docker-compose.yml 文件 docker-compose.yml 文件如图所示。
version: 3.1
services:seata-server:image: seataio/seata-server:1.6.1ports:- 7091:7091- 8091:8091environment:- STORE_MODEdb# 以SEATA_IP作为host注册seata server- SEATA_IP192.168.11.82- SEATA_PORT8091volumes:- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime #设置系统时区- /usr/share/zoneinfo/Asia/Shanghai:/etc/timezone #设置时区# 假设我们通过docker cp命令把资源文件拷贝到相对路径./seata-server/resources中# 如有问题请阅读上面的[注意事项]以及[使用自定义配置文件]- ./seata-server/resources:/seata-server/resources4.2 运行容器
版本和配置文件保持一致
目的是找到 id docker run -d --rm seataio/seata-server:1.6.1 拷贝文件
利用id拷贝文件将容器里的文件拷贝到宿主机 docker cp 07d0:/seata-server/resources /opt/seata/seata-server/resources 修改application.yml文件内容 application.yml
server:port: 7091spring:application:name: seata-serverconsole:user:username: seatapassword: seataseata:config:# support: nacos, consul, apollo, zk, etcd3type: nacosnacos:server-addr: 192.168.11.82:8848namespace: publicgroup: DEFAULT_GROUPusername: nacospassword: nacoscontext-path:##if use MSE Nacos with auth, mutex with username/password attribute#access-key:#secret-key:data-id: seataServer.propertiesregistry:# support: nacos, eureka, redis, zk, consul, etcd3, sofatype: nacosnacos:application: seata-serverserver-addr: 192.168.11.82:8848group: DEFAULT_GROUPnamespace: publiccluster: defaultusername: nacospassword: nacoscontext-path:##if use MSE Nacos with auth, mutex with username/password attribute#access-key:#secret-key:# server:# service-port: 8091 #If not configured, the default is ${server.port} 1000security:secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017tokenValidityInMilliseconds: 1800000ignore:urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/loginlogging:config: classpath:logback-spring.xmlfile:path: ${user.home}/logs/seataextend:logstash-appender:destination: 127.0.0.1:4560kafka-appender:bootstrap-servers: 127.0.0.1:9092topic: logback_to_logstash4.3 在nacos里配置seata的相关信息 只需修改数据库相关配置即可,数据库名和第二个大标题建的保持一致 seata_tc #For details about configuration items, see https://seata.io/zh-cn/docs/user/configurations.html
#Transport configuration, for client and server
transport.typeTCP
transport.serverNIO
transport.heartbeattrue
transport.enableTmClientBatchSendRequestfalse
transport.enableRmClientBatchSendRequesttrue
transport.enableTcServerBatchSendResponsefalse
transport.rpcRmRequestTimeout30000
transport.rpcTmRequestTimeout30000
transport.rpcTcRequestTimeout30000
transport.threadFactory.bossThreadPrefixNettyBoss
transport.threadFactory.workerThreadPrefixNettyServerNIOWorker
transport.threadFactory.serverExecutorThreadPrefixNettyServerBizHandler
transport.threadFactory.shareBossWorkerfalse
transport.threadFactory.clientSelectorThreadPrefixNettyClientSelector
transport.threadFactory.clientSelectorThreadSize1
transport.threadFactory.clientWorkerThreadPrefixNettyClientWorkerThread
transport.threadFactory.bossThreadSize1
transport.threadFactory.workerThreadSizedefault
transport.shutdown.wait3
transport.serializationseata
transport.compressornone#Transaction routing rules configuration, only for the client
# 此处的mygroup名字可以自定义但是最好不要改保存默认
service.vgroupMapping.mygroupdefault
#If you use a registry, you can ignore it
service.default.grouplist127.0.0.1:8091
service.enableDegradefalse
service.disableGlobalTransactionfalse#Transaction rule configuration, only for the client
client.rm.asyncCommitBufferLimit10000
client.rm.lock.retryInterval10
client.rm.lock.retryTimes30
client.rm.lock.retryPolicyBranchRollbackOnConflicttrue
client.rm.reportRetryCount5
client.rm.tableMetaCheckEnabletrue
client.rm.tableMetaCheckerInterval60000
client.rm.sqlParserTypedruid
client.rm.reportSuccessEnablefalse
client.rm.sagaBranchRegisterEnablefalse
client.rm.sagaJsonParserfastjson
client.rm.tccActionInterceptorOrder-2147482648
client.tm.commitRetryCount5
client.tm.rollbackRetryCount5
client.tm.defaultGlobalTransactionTimeout60000
client.tm.degradeCheckfalse
client.tm.degradeCheckAllowTimes10
client.tm.degradeCheckPeriod2000
client.tm.interceptorOrder-2147482648
client.undo.dataValidationtrue
client.undo.logSerializationjackson
client.undo.onlyCareUpdateColumnstrue
server.undo.logSaveDays7
server.undo.logDeletePeriod86400000
client.undo.logTableundo_log
client.undo.compress.enabletrue
client.undo.compress.typezip
client.undo.compress.threshold64k
#For TCC transaction mode
tcc.fence.logTableNametcc_fence_log
tcc.fence.cleanPeriod1h#Log rule configuration, for client and server
log.exceptionRate100#Transaction storage configuration, only for the server. The file, db, and redis configuration values are optional.
# 默认为file一定要改为db我们自己的服务启动会连接不到seata
store.modedb
store.lock.modedb
store.session.modedb
#Used for password encryption#These configurations are required if the store mode is db. If store.mode,store.lock.mode,store.session.mode are not equal to db, you can remove the configuration block.
# 修改mysql的配置
store.db.datasourcedruid
store.db.dbTypemysql
store.db.driverClassNamecom.mysql.cj.jdbc.Driver
store.db.urljdbc:mysql://192.168.11.79:3306/seata_tc?useUnicodetruecharacterEncodingutf8connectTimeout1000socketTimeout3000autoReconnecttrueuseSSLfalse
store.db.userroot
store.db.passwordroot123
store.db.minConn5
store.db.maxConn30
store.db.globalTableglobal_table
store.db.branchTablebranch_table
store.db.distributedLockTabledistributed_lock
store.db.queryLimit100
store.db.lockTablelock_table
store.db.maxWait5000#Transaction rule configuration, only for the server
server.recovery.committingRetryPeriod1000
server.recovery.asynCommittingRetryPeriod1000
server.recovery.rollbackingRetryPeriod1000
server.recovery.timeoutRetryPeriod1000
server.maxCommitRetryTimeout-1
server.maxRollbackRetryTimeout-1
server.rollbackRetryTimeoutUnlockEnablefalse
server.distributedLockExpireTime10000
server.xaerNotaRetryTimeout60000
server.session.branchAsyncQueueSize5000
server.session.enableBranchAsyncRemovefalse
server.enableParallelRequestHandlefalse#Metrics configuration, only for the server
metrics.enabledfalse
metrics.registryTypecompact
metrics.exporterListprometheus
metrics.exporterPrometheusPort9898
4.4 启动 1.先cd 到seata文件夹再执行下面的命令 docker-compose up -d 去nacos里查看服务是否启动 访问 端口为7091