seata与nacos 配置中心的整合
获取配置文件
1.需要从官网仓库下载源码包
2.在script\config-center路径下获取config.txt文件
3.新建seata专用的命名空间
4.在nacos配置中心里新建seataServer.properties配置,并将config.txt文件内的内容复制进去
修改seata服务的配置
1.获取seata的程序包
2.解压后找到conf目录下的registry.conf文件
3.修改注册中心配置
找到registry下的type配置,将其改为nacos,并找到nacos配置进行修改
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "nacos"
nacos {
application = "seata-server"
serverAddr = "127.0.0.1:8848"
group = "SEATA_GROUP"
namespace = "cd5d9687-2d6c-41bf-8ddf-48bddb2684e2"
cluster = "default"
username = "nacos"
password = "nacos"
}
}
4.修改配置中心的配置
找到config下的type配置,将其改为nacos,并找到nacos配置进行修改
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos"
nacos {
serverAddr = "127.0.0.1:8848"
namespace = "cd5d9687-2d6c-41bf-8ddf-48bddb2684e2"
group = "SEATA_GROUP"
username = "naocs"
password = "nacos"
dataId = "seataServer.properties"
}
}
最后启动即可
sh seata-server.sh -p 8091 -h 127.0.0.1