一、部署1.5.2
1、解压缩 tar -xvf apache-seata-***-incubating-bin.tar.gz
2、修改conf下的application.yml 只需要修改seata下的此配置,然后再nacos中添加其它配置,下面是application.yml的配置:
server:port: 7091spring:application:name: seata-serverlogging:config: classpath:logback-spring.xmlfile:path: /usr/local/seata/logsconsole:user:username: seatapassword: *******seata:config:# support: nacos 、 consul 、 apollo 、 zk 、 etcd3type: nacosnacos:# nacos ip地址server-addr: 127.0.0.1:8848group: SEATA_GROUPnamespace: mesusername: nacospassword: *******##if use MSE Nacos with auth, mutex with username/password attribute#access-key: ""#secret-key: ""# 读取nacos上的配置文件data-id: seataServer.ymlregistry:# support: nacos 、 eureka 、 redis 、 zk 、 consul 、 etcd3 、 sofatype: nacosnacos:application: seata-server# nacos ip地址server-addr: 127.0.0.1:8848group: SEATA_GROUPnamespace: mescluster: defaultusername: nacospassword: ********##if use MSE Nacos with auth, mutex with username/password attribute#access-key: ""#secret-key: ""
# store: //可以在此配置也可以在nacos的seata配置文件yml中配置# support: file 、 db 、 redis
# mode: file
# server:
# service-port: 8091 #If not configured, the default is '${server.port} + 1000'security:secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017tokenValidityInMilliseconds: 1800000ignore:urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login
3、在nacos配置seata的服务端配置
-
建立一个SEATA_GROUP的分组,专门放置seata客户端和服务端的配置
- 建seataServer.yml配置,如图示:
- 具体服务端配置如下:
service:vgroupMapping:system-group: defaultjob-group: defaultjimureport-group: defaultauth-group: defaultmonitor-group: defaultgen-group: defaultgateway-group: defaultfile-group: defaultmes-baseinfo-group: defaultmes-technology-group: defaultmes-planning-group: defaultmes-warehouse-group: defaultmes-produce-group: defaultmes-integrate-group: default store:db:datasource: druiddbType: mysqldriverClassName: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://*****:3306/seata?useUnicode=trueuser: rootpassword: *******globalTable: global_tablelockTable: lock_tablebranchTable: branch_tablemaxConn: 30maxWait: 5000minConn: 5queryLimit: 100mode: dbsession: mode: dblock:mode: db
其中store下的配置也可以直接放到seata的conf下的application.yml中,其实conf下的application.yml+nacos下的seataServer.yml总体构成了总的配置文件。
4、在nacos配置seata的客户端配置
所有的微服务加seata配置
- 在SEATA_GROUP组中加配置
- 在 微服务配置中加seata配置
# seata配置 seata:# 默认关闭,如需启用spring.datasource.dynami.seata需要同时开启enabled: true# Seata 应用编号,默认为 ${spring.application.name}application-id: ${spring.application.name}# Seata 事务组编号,用于 TC 集群名tx-service-group: ${spring.application.name}-group# 关闭自动代理enable-auto-data-source-proxy: false# 服务配置项service:# 虚拟组和分组的映射vgroup-mapping:mes-baseinfo-group: defaultconfig:type: nacosnacos:server-addr: ****:8848group: SEATA_GROUPnamespace: et-mesusername: nacospassword: *****registry:type: nacosnacos:application: seata-serverserver-addr: ****:8848namespace: et-mesgroup: SEATA_GROUPusername: nacospassword: ****cluster: default
5、启动seata
-
在bin下执行sh seata-server.sh 启动命令,成功后可以在nacos的注册中心看到seata服务
二、升级seata1.5.2到2.1.0
1、经过比对,数据库脚本没变
2、把1.5.2的application.yml拷过来覆盖默认配置
3、关键到了,2.1.0中lib下jdbc文件夹下没有jar,需要我们从其它地方复制一个jdbc的jar过来,才能启动成功。
4、启动,完美成功。