Nacos 设计模型
nameSpace->group->Service/DataId
Nacos 服务领域模型
@Autowired private LoadBalancerClient loadBalancerClient; @Autowired private RestTemplate restTemplate; //获取服务实例,使用负载均衡客户端根据服务名选择实例 ServiceInstance serviceInstance = loadBalancerClient.choose("dubbo-provider"); URI uri = serviceInstance.getUri(); //ip+端口号 restTemplate.getForObject(uri+"/student/list",String.class); //参数详情{"host":"2.0.3.92","instanceId":"2.0.3.92:20880","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://2.0.3.92:20880/com.alibaba.cloud.dubbo.service.DubbometadataService?anyhost=true&application=dubbo-provider&bind.ip=2.0.3.92&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=dubbo-provider&interface=com.alibaba.cloud.dubbo.service.DubbometadataService&metadata-type=remote&methods=getAllServiceKeys,getServiceRestmetadata,getExportedURLs,getAllExportedURLs&pid=39176&qos.enable=false&release=2.7.8&revision=2.2.2.RELEASE&side=provider×tamp=1644200749402&version=1.0.0" ]","preserved.register.source":"SPRING_CLOUD","dubbo.protocols.dubbo.port":"20880"},"port":20880,"secure":false,"server":{"alive":true,"host":"2.0.3.92","hostPort":"2.0.3.92:20880","id":"2.0.3.92:20880","instance":{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"2.0.3.92#20880#DEFAULT#DEFAULT_GROUP@@dubbo-provider","ip":"2.0.3.92","ipDeleteTimeout":30000,"metadata":{"$ref":"$.metadata"},"port":20880,"serviceName":"DEFAULT_GROUP@@dubbo-provider","weight":1.0},"metaInfo":{"appName":"DEFAULT_GROUP@@dubbo-provider","instanceId":"2.0.3.92#20880#DEFAULT#DEFAULT_GROUP@@dubbo-provider"},"metadata":{"$ref":"$.metadata"},"port":20880,"readyToServe":true,"zone":"UNKNOWN"},"serviceId":"dubbo-provider","uri":"http://2.0.3.92:20880"}