Seata 单机环境搭建_01
文章目錄
- 一、整合版本說明
- 1. 畢業版本依賴關系(推薦使用)
- 2. 組件版本關系
- 3. 演示版本
- 二、部署單機 TC Server
- 2.1. 下載Seata
- 2.2. 解壓縮
- 2.3. 啟動
- 2.4. 監聽日志
- 2.5. 啟動命令講解
一、整合版本說明
1. 畢業版本依賴關系(推薦使用)
| Spring Cloud 2020.0.0 | 2021.1 | 2.4.2 |
| Spring Cloud Hoxton.SR9 | 2.2.6.RELEASE | 2.3.2.RELEASE |
| Spring Cloud Greenwich.SR6 | 2.1.4.RELEASE | 2.1.13.RELEASE |
| Spring Cloud Hoxton.SR3 | 2.2.1.RELEASE | 2.2.5.RELEASE |
| Spring Cloud Hoxton.RELEASE | 2.2.0.RELEASE | 2.2.X.RELEASE |
| Spring Cloud Greenwich | 2.1.2.RELEASE | 2.1.X.RELEASE |
2. 組件版本關系
| 2.2.6.RELEASE | 1.8.1 | 1.4.2 | 4.4.0 | 2.7.8 | 1.3.0 |
| 2021.1 or 2.2.5.RELEASE or 2.1.4.RELEASE or 2.0.4.RELEASE | 1.8.0 | 1.4.1 | 4.4.0 | 2.7.8 | 1.3.0 |
| 2.2.3.RELEASE or 2.1.3.RELEASE or 2.0.3.RELEASE | 1.8.0 | 1.3.3 | 4.4.0 | 2.7.8 | 1.3.0 |
| 2.2.1.RELEASE or 2.1.2.RELEASE or 2.0.2.RELEASE | 1.7.1 | 1.2.1 | 4.4.0 | 2.7.6 | 1.2.0 |
| 2.2.0.RELEASE | 1.7.1 | 1.1.4 | 4.4.0 | 2.7.4.1 | 1.0.0 |
3. 演示版本
| Spring Cloud Hoxton.SR9 | 2.2.6.RELEASE | 2.3.2.RELEASE | 1.4.2 | 1.8.202 |
按我們使用的SpringCloudAlibaba的版本是2.2.6, 此次我們應該使用1.3.0版本的Seata進行安裝。
版本說明:
https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E
二、部署單機 TC Server
2.1. 下載Seata
在https://github.com/seata/seata/releases 這里找到對應的版本軟件包進行下載
下載地址:https://github.com/seata/seata/releases/download/v1.3.0/seata-server-1.3.0.zip
注:單機模式只適用于學習或者本地測試階段,生產環境推薦使用集群模式。
2.2. 解壓縮
cd /app unzip seata-server-1.3.0.zip2.3. 啟動
[root@node2 app]# cd seata/bin/ [root@node2 bin]# nohup ./seata-server.sh &2.4. 監聽日志
[root@node2 bin]# [root@node2 bin]# tail -f nohup.out
可以看到日志中已經默認啟動了 8091端口
因為 TC 需要進行全局事務和分支事務的記錄,所以需要對應的存儲。目前,TC 有兩種存儲模式( store.mode ):
file 模式:適合單機模式,全局事務會話信息在內存中讀寫,并持久化本地文件 root.data,性能較高。
db 模式:適合集群模式,全局事務會話信息通過 db 共享,相對性能差點。
顯然,我們將采用 file 模式,最終我們部署單機 TC Server 如下圖所示:
因為我們使用 file 模式,所以可以看到用于持久化的本地文件 root.data。操作命令如下:
可以看到,已經默認生成了root.data文件
2.5. 啟動命令講解
sh seata-server.sh -p $LISTEN_PORT -m $MODE(file or db) -h $HOST -e $ENV
-p seata-server 監聽服務端口號
-m 存儲模式,可選值:file、db。file 用于單點模式,db用于ha模式,當使用db存儲模式,需要修改配置中store配置節點的數據庫配置,同時在數據庫中初始化的sql
-h 用于解決seata-server和業務側跨網絡問題,其配置的host值直接顯示到注冊中心的服務可用地址host,當跨網絡時這里需要配置為公網IP或NATIP,若都在同一局域網則無需配置
-e 用于解決多環境配置中心隔離問題
接下一篇:Seata 與 Nacos注冊中心整合實現集群環境搭建_02
總結
以上是生活随笔為你收集整理的Seata 单机环境搭建_01的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: H5 微信公众号 授权登录 前后端分离篇
- 下一篇: uni-app中使用腾讯位置服务实现小程