使用springCloud+nacos集成seata1.3.0搭建过程
1.docker安装seata 1.3.0镜像
docker pull seataio/seata-server:1.3.0
2.运行容器获取配置文件
docker run --name seata-server -p 8091:8091 -d seataio/seata-server:1.3.0
3.将容器中的配置拷贝到/usr/local/seata-1.3.0
docker cp seata-server:/seata-server /usr/local/seata-1.3.0
4.停止容器 删除容器
docker stop seata-server
docekr rm seata-server
5.进入目录/usr/local/seata-1.3.0/resources中修改file.conf和registry.conf中的内容
修改file.conf: mode=db 修改数据源的配置,这里选用的是mysql 参考下方配图
修改fegister.conf文件 这里seata的注册 配置 都是注册到nacos上的 参考下方配图
6.下载文件 (目的是初始化配置并注册推送到nacos上):
cd /usr/local
mkdir seata
##下载seata1.3.0
wget https://github.com/seata/seata/releases/download/v1.3.0/seata-server-1.3.0.tar.gz
解压文件
tar -zxvf seata-server-1.3.0.tar.gz
进入解压后的文件
cd seata
7.初始化数据库
seata初始化数据库建表sql
8.修改file.conf**
9.修改registry.conf
10.初始化配置信息
创建config.txt文件,并配置。
cd /usr/local/seata/seata
vim config.txt
transport.type=TCP transport.server=NIO transport.heartbeat=true transport.enableClientBatchSendRequest=false transport.threadFactory.bossThreadPrefix=NettyBoss transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler transport.threadFactory.shareBossWorker=false transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector transport.threadFactory.clientSelectorThreadSize=1 transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread transport.threadFactory.bossThreadSize=1 transport.threadFactory.workerThreadSize=default transport.shutdown.wait=3 service.vgroupMapping.my_test_tx_group=default service.default.grouplist=127.0.0.1:8091 service.enableDegrade=false service.disableGlobalTransaction=false client.rm.asyncCommitBufferLimit=10000 client.rm.lock.retryInterval=10 client.rm.lock.retryTimes=30 client.rm.lock.retryPolicyBranchRollbackOnConflict=true client.rm.reportRetryCount=5 client.rm.tableMetaCheckEnable=false client.rm.sqlParserType=druid client.rm.reportSuccessEnable=false client.rm.sagaBranchRegisterEnable=false client.tm.commitRetryCount=5 client.tm.rollbackRetryCount=5 client.tm.defaultGlobalTransactionTimeout=60000 client.tm.degradeCheck=false client.tm.degradeCheckAllowTimes=10 client.tm.degradeCheckPeriod=2000 ##file修改为db store.mode=db store.file.dir=file_store/data store.file.maxBranchSessionSize=16384 store.file.maxGlobalSessionSize=512 store.file.fileWriteBufferCacheSize=16384 store.file.flushDiskMode=async store.file.sessionReloadReadSize=100 ##数据源配置 store.db.datasource=druid store.db.dbType=mysql store.db.driverClassName=com.mysql.jdbc.Driver store.db.url=jdbc:mysql://192.168.1.8:3306/seata?useUnicode=true store.db.user=root store.db.password=root ##end store.db.minConn=5 store.db.maxConn=30 store.db.globalTable=global_table store.db.branchTable=branch_table store.db.queryLimit=100 store.db.lockTable=lock_table store.db.maxWait=5000 store.redis.host=127.0.0.1 store.redis.port=6379 store.redis.maxConn=10 store.redis.minConn=1 store.redis.database=0 store.redis.password=null store.redis.queryLimit=100 server.recovery.committingRetryPeriod=1000 server.recovery.asynCommittingRetryPeriod=1000 server.recovery.rollbackingRetryPeriod=1000 server.recovery.timeoutRetryPeriod=1000 server.maxCommitRetryTimeout=-1 server.maxRollbackRetryTimeout=-1 server.rollbackRetryTimeoutUnlockEnable=false client.undo.dataValidation=true client.undo.logSerialization=jackson client.undo.onlyCareUpdateColumns=true server.undo.logSaveDays=7 server.undo.logDeletePeriod=86400000 client.undo.logTable=undo_log client.log.exceptionRate=100 transport.serialization=seata transport.compressor=none metrics.enabled=false metrics.registryType=compact metrics.exporterList=prometheus metrics.exporterPrometheusPort=9898 service.vgroup-mapping.sub-tx-group=default service.vgroup-mapping.admin-tx-group=
11.切换到seata目录下 创建script文件夹,创建 nacos-config.sh 导入脚本
脚本链接
修改sh文件的权限:chmod +x nacos-config.sh
接下来需要导入配置到nacos 进入script文件夹执行
将seata配置文件推送到nacos -h[nacos地址] -p[端口] -g[SEATA_GROUP] -t[namespace]
sh nacos-config.sh -h nacos地址 -p 8848 -g SEATA_GROUP -t nacos命名空间
如果运行成功,即可以在配置的nacos上看见seata-server服务。
12.在seata 文件夹下可以创建logs文件夹,用来存放seata日志
修改conf文件下 logback.xml 文件
13.重新启动容器
启动容器,并设置容器为自动重启
以后可以用docker restart 或docker start 进行启动或者关闭
注:liunx 开放端口号命令可参考
centos7防火墙操作命令
docker run -d --restart always --name seata-server -p 8091:8091 -v /usr/local/seata-1.3.0:/seata-server -e SEATA_IP=192.168.1.206 -e SEATA_PORT=8091 seataio/seata-server:1.3.0
更详细的资料或者视频可以参考博客博客链接
到此这篇关于使用springCloud+nacos集成seata1.3.0搭建过程的文章就介绍到这了,更多相关springCloud nacos集成seata1.3.0内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!