微服务启动提示:can not get cluster name in registry config 'service.vgroupMapping.lytest1', please make sure registry config correct
问题相关代码
1、微服务配置文件
seata:
tx-service-group: lytest1
service:
vgroup-mapping:
lytest1: default
registry:
type: nacos
nacos:
server-addr: 192.168.3.36:8848
application: seata-server
username: nacos
password: nacos
group: SEATA-GROUP
namespace: b02b37b1-4667-4b3c-b77c-4b741555306d
config:
type: nacos
nacos:
data-id: seata.properties
server-addr: 192.168.3.36:8848
username: nacos
password: nacos
group: SEATA-GROUP
namespace: b02b37b1-4667-4b3c-b77c-4b741555306d
2、Seata docker-compose.yml
version: "3.7"
services:
seata-server:
image: seataio/seata-server:1.4.2
container_name: seata-server
networks:
- seata-server
restart: "always"
volumes:
- ./registry.conf:/root/seata-config/registry.conf
ports:
- 8091:8091
environment:
- SEATA_PORT=8091
- SEATA_CONFIG_NAME=file:/root/seata-config/registry
expose:
- 8091
networks:
seata-server:
external: true
3、registry.conf
registry {
type = "nacos"
nacos {
application = "seata-server"
serverAddr = "192.168.3.36:8848"
group = "SEATA_GROUP"
namespace = "b02b37b1-4667-4b3c-b77c-4b741555306d"
cluster = "default"
username = "nacos"
password = "nacos"
}
}
config {
type = "nacos"
nacos {
serverAddr = "192.168.3.36:8848"
namespace = "b02b37b1-4667-4b3c-b77c-4b741555306d"
group = "SEATA_GROUP"
username = "nacos"
password = "nacos"
dataId = "seata.properties"
}
}
4、Seata 配置文件
尝试过切换 namespace,问题依然存在,不确定是哪里处理问题
1.把registry.conf中的dataId和微服务yml配置data-id注释掉;
2.在官方文档https://github.com/seata/seata/tree/develop/script,找到脚本nacos-config.sh,和配置文件config.txt,按照你的seata.properties修改config.txt参数;
3.启动Seata容器时,先执行nacos-config.sh(注意和config.txt位置同级),执行后脚本会把配置写入Nacos中;
4.再次启动Seata容器