一、部署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、啟動,完美成功。