Seata是阿里發佈的一個分佈式的解決方案,在V1.0版本支持HA集羣版本的,解決了單點故障問題
項目開源地址
下載Seata服務端代碼
https://github.com/seata/seata/releases
如果window操作系統則下載zip文件,如果是linux系統則下載tar.zg文件,本人這裏選擇tar.gz文件
修改配置文件
修改seata的根目錄下的conf/file.conf
注意修改紅色圈起來的和把數據源改成你自己的數據庫地址,數據庫腳本在Seata的git開源地址下
注意自己創建一個數據庫,然後再執行sql腳本,最後在根據你執行的sql腳本,把數據源改成你自己的數據源的相關配置
修改conf/registry.conf配置文件
此配置文件主要是配置註冊中心和配置中心的地址的
支持的註冊中心有file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
支持的配置中心有file、nacos 、apollo、zk、consul、etcd3
相關內容如下:
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "eureka" #指定註冊中心使用的是哪種註冊組件,值爲上面的這些
nacos {
serverAddr = "localhost"
namespace = ""
cluster = "default"
}
eureka {
serviceUrl = "http://192.168.1.1:8000/eureka"
application = "default"
weight = "1"
}
redis {
serverAddr = "localhost:6379"
db = "0"
}
zk {
cluster = "default"
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
consul {
cluster = "default"
serverAddr = "127.0.0.1:8500"
}
etcd3 {
cluster = "default"
serverAddr = "http://localhost:2379"
}
sofa {
serverAddr = "127.0.0.1:9603"
application = "default"
region = "DEFAULT_ZONE"
datacenter = "DefaultDataCenter"
cluster = "default"
group = "SEATA_GROUP"
addressWaitTime = "3000"
}
file {
name = "file.conf"
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "file" ##指定配置中心使用的是哪種配置組件,值爲上面的這些
nacos {
serverAddr = "localhost"
namespace = ""
}
consul {
serverAddr = "127.0.0.1:8500"
}
apollo {
app.id = "seata-server"
apollo.meta = "http://192.168.1.204:8801"
}
zk {
serverAddr = "127.0.0.1:2181"
session.timeout = 6000
connect.timeout = 2000
}
etcd3 {
serverAddr = "http://localhost:2379"
}
file {
name = "file.conf"
}
}
啓動Seata的服務端
./seata-server.sh