一、客户端自动注册实例流程
1.首先客户端需要引入服务发现包
<groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId><version>2.2.6.RELEASE</version>
2. NacosServiceRegistryAutoConfiguration 配置类
此类在spring-cloud-starter-alibaba-nacos-discovery客户包里面会自动在当前SPRINGBOOT容器注册
。
3.此配置类最核心的实体注册类为NacosAutoServiceRegistration,
查看此类的继承属性
发现此类继承于spring cloud common的AbstractAutoServiceRegistration抽象继承类,此类包含了与SPRING对接的一系列自动注册功能。并且实现了ApplicationListener接口,所以会监听SPRING WEB事件。
4.监听ServletWebServerInitializedEvent事件
5.AbstractAutoServiceRegistration自动更新服务端口
6.NacosAutoServiceRegistration更新端口,以及配置里面的分组,集群等信息。
7.跳到父类的注册方法
8.最终调用了NacosServiceRegistry.registry
9.接着触发了NacosNamingService.registerInstance
注意这里,如果是临时节点,还会触发客户端定时发送心跳。
这里已经跳到了nacos-client-1.4.2的包,相当于是具体注册中心客户端的实现。
10.接着跳到了NamingProxy.registerService,
11.最终发起HTTP调用请求,NamingProxy
public String reqApi(String api, Map<String, String> params, Map<String, String> body, List<String> servers,String method) throws NacosException {params.put(CommonParams.NAMESPACE_ID, getNamespaceId());if (CollectionUtils.isEmpty(servers) && StringUtils.isBlank(nacosDomain)) {throw new NacosException(NacosException.INVALID_PARAM, "no server available");}NacosException exception = new NacosException();if (StringUtils.isNotBlank(nacosDomain)) {for (int i = 0; i < maxRetry; i++) {try {return callServer(api, params, body, nacosDomain, method);} catch (NacosException e) {exception = e;if (NAMING_LOGGER.isDebugEnabled()) {NAMING_LOGGER.debug("request {} failed.", nacosDomain, e);}}}} else {Random random = new Random(System.currentTimeMillis());int index = random.nextInt(servers.size());for (int i = 0; i < servers.size(); i++) {String server = servers.get(index);try {return callServer(api, params, body, server, method);} catch (NacosException e) {exception = e;if (NAMING_LOGGER.isDebugEnabled()) {NAMING_LOGGER.debug("request {} failed.", server, e);}}index = (index + 1) % servers.size();}}NAMING_LOGGER.error("request: {} failed, servers: {}, code: {}, msg: {}", api, servers, exception.getErrCode(),exception.getErrMsg());throw new NacosException(exception.getErrCode(),"failed to req API:" + api + " after all servers(" + servers + ") tried: " + exception.getMessage());}
如果是带域名,或者单机运行,则直接发起HTTP调用,如果是集群NACOS服务列表,则随机找到一台NACOS服务器发起请求。
12.客户端注册完成
二、服务端注册流程
1.下载1.4.2源码,本地启动
-Dnacos.standalone=true -Dnacos.home=e:
acos
启动类为com.alibaba.nacos.Nacos
2.服务端是SPRINGBOOT项目,找到控制器接口
3.首先进入InstanceController.register
4.进入ServiceManager.register,此类就是客户端服务实例的管理类,保存客户端实例的注册表。
@Component
public class ServiceManager implements RecordListener<Service> {/*** Map(namespace, Map(group::serviceName, Service)). 真正的注册表*/private final Map<String, Map<String, Service>> serviceMap = new ConcurrentHashMap<>();private final LinkedBlockingDeque<ServiceKey> toBeUpdatedServicesQueue = new LinkedBlockingDeque<>(1024 * 1024);private final Synchronizer synchronizer = new ServiceStatusSynchronizer();private final Lock lock = new ReentrantLock();@Resource(name = "consistencyDelegate")//一致性协调协议 private ConsistencyService consistencyService;private final SwitchDomain switchDomain;private final DistroMapper distroMapper;private final ServerMemberManager memberManager;private final PushService pushService;private final RaftPeerSet raftPeerSet;
5.如果服务不存在,则会创建一个空的Service对象。
注意,此时的servicename已经带了分组了。
6.调试日志输出等级
因为服务端源码有多个线程协作,调试比较麻烦,建议看代码,然后加日志打印输出。
可以把naming的LOGBACK日志输出等级调成DEBUG
<?xml version="1.0" encoding="UTF-8"?>
<!--~ Copyright 1999-2018 Alibaba Group Holding Ltd.~~ Licensed under the Apache License, Version 2.0 (the "License");~ you may not use this file except in compliance with the License.~ You may obtain a copy of the License at~~ http://www.apache.org/licenses/LICENSE-2.0~~ Unless required by applicable law or agreed to in writing, software~ distributed under the License is distributed on an "AS IS" BASIS,~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.~ See the License for the specific language governing permissions and~ limitations under the License.--><included><springProperty scope="context" name="logPath" source="nacos.logs.path" defaultValue="${user.home}/nacos/logs"/><property name="LOG_HOME" value="${logPath}"/><appender name="naming-server"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-server.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-server.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>2GB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>7GB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-raft"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-raft.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-raft.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>20MB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>128MB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-event"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-event.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-event.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>20MB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>128MB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-push"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-push.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-push.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>20MB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>128MB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-rt"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-rt.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-rt.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>1GB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>3GB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-performance"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-performance.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-performance.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>50MB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>512MB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-router"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-router.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-router.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>2GB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>7GB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date|%msg%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-cache"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-cache.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-cache.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>1GB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>3GB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date|%msg%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-device"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-device.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-device.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>2GB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>7GB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date|%msg%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-tag"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-tag.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-tag.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>1GB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>3GB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-debug"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-debug.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-debug.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>20MB</maxFileSize><maxHistory>15</maxHistory><totalSizeCap>128MB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="naming-distro"class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${LOG_HOME}/naming-distro.log</file><append>true</append><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><fileNamePattern>${LOG_HOME}/naming-distro.log.%d{yyyy-MM-dd}.%i</fileNamePattern><maxFileSize>1GB</maxFileSize><maxHistory>7</maxHistory><totalSizeCap>3GB</totalSizeCap><cleanHistoryOnStart>true</cleanHistoryOnStart></rollingPolicy><encoder><Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><appender name="CONSOLE2" class="ch.qos.logback.core.ConsoleAppender"><encoder><Pattern>%date %level [%thread] [%C:%M:%L] %msg%n%n</Pattern><charset>UTF-8</charset></encoder></appender><logger name="com.alibaba.nacos.naming.main" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-server"/><appender-ref ref="CONSOLE2"/></logger><logger name="com.alibaba.nacos.naming.raft" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-raft"/><appender-ref ref="CONSOLE2"/></logger><logger name="com.alibaba.nacos.naming.distro" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-distro"/><appender-ref ref="CONSOLE2"/></logger><logger name="com.alibaba.nacos.naming.event" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-event"/><appender-ref ref="CONSOLE2"/></logger><logger name="com.alibaba.nacos.naming.push" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-push"/><appender-ref ref="CONSOLE2"/></logger><logger name="com.alibaba.nacos.naming.rt" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-rt"/><appender-ref ref="CONSOLE2"/></logger><logger name="com.alibaba.nacos.naming.performance" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-performance"/></logger><logger name="com.alibaba.nacos.naming.router" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-router"/></logger><logger name="com.alibaba.nacos.naming.cache" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-cache"/></logger><logger name="com.alibaba.nacos.naming.debug" additivity="false"><level value="DEBUG"/><appender-ref ref="naming-debug"/><appender-ref ref="CONSOLE2"/></logger></included>
7.业务日志APPENDER类分析
有一个统一的日志输出类,将各种业务分别用不同的APPENDER对象输出
public class Loggers {//客户端推送public static final Logger PUSH = LoggerFactory.getLogger("com.alibaba.nacos.naming.push");//心跳检测public static final Logger CHECK_RT = LoggerFactory.getLogger("com.alibaba.nacos.naming.rt");//服务相关业务public static final Logger SRV_LOG = LoggerFactory.getLogger("com.alibaba.nacos.naming.main");//通知事件,如新服务注册,变更,下线等。public static final Logger EVT_LOG = LoggerFactory.getLogger("com.alibaba.nacos.naming.event");//一致性RAFT系统 CPpublic static final Logger RAFT = LoggerFactory.getLogger("com.alibaba.nacos.naming.raft");//一致性协议 ,APpublic static final Logger DISTRO = LoggerFactory.getLogger("com.alibaba.nacos.naming.distro");//性能分析public static final Logger PERFORMANCE_LOG = LoggerFactory.getLogger("com.alibaba.nacos.naming.performance");
8.注册后的serviceMap结构如下:
单个Service的示例结构如下:
{"name":"mall@@joyday","protectThreshold":0,"groupName":"mall","metadata":{},"finalizeCount":2,"owners":[],"resetWeight":false,"enabled":true,"selector":{"type":"none"},"namespaceId":"public","ipDeleteTimeout":30000,"lastModifiedMillis":1722671874301,"checksum":"f936119262bea62fbfbb16c10f955e96","clusterMap":{"beijing":{"serviceName":"mall@@joyday","name":"beijing","healthChecker":{"type":"TCP"},"defaultPort":80,"defaultCheckPort":80,"useIPPort4Check":true,"metadata":{},"sitegroup":"","defCkport":80,"empty":false,"defIPPort":80}},"empty":false
}
9.进入ServiceMananger.addInstance,查看保存到一致性服务的dataStore中的KEY,为命名空间+分组+服务名,值为Instances,这个对象里面又包含了一个instance的LIST.
10.进入ServiceMananger.updateIpAddresses,可以更详细看到dataMap,这个就是把dataMap当作旧的注册表,把二级缓存Service中的ClusterMap作为新对象进行比较,从而把新的实例加进到datamap中。
11.进入到DistroConsistencyServiceImpl.onPut,查看单个dataTum
12.Service为其中一个listener,异步收到消息。
13.再将变化的Instances中的实例保存重新刷新到Service的clusterMap中,Service.
updateIPs
注意在这里,会给pushService发出通知,通知相关客户端此服务的实例发生变化。
14.我们再启动一个新的实例,查看clusterMap,dataStore的变化。看到端口变成了8066
15.第一次8064服务启动日志
2024-08-03 16:40:36,500 DEBUG [http-nio-8848-exec-5] [com.alibaba.nacos.naming.controllers.InstanceController:doSrvIpxt:691] no instance to serve for service: mall@@joyday2024-08-03 16:40:37,151 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:createServiceIfAbsent:471] creating empty service public:mall@@joyday2024-08-03 16:40:37,158 DEBUG [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.Service:recalculateChecksum:549] service to json: {"invalidIPCount":0,"name":"mall@@joyday","ipCount":0,"owners":[],"protectThreshold":0.0,"clusters":[]}2024-08-03 16:40:37,162 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.consistency.persistent.raft.RaftCore:listen:962] add listener: com.alibaba.nacos.naming.iplist.public##mall@@joyday2024-08-03 16:40:37,251 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:putServiceAndInit:902] [NEW-SERVICE] {"name":"mall@@joyday","protectThreshold":0.0,"groupName":"mall","metadata":{},"finalizeCount":0,"owners":[],"resetWeight":false,"enabled":true,"selector":{"type":"none"},"namespaceId":"public","ipDeleteTimeout":30000,"lastModifiedMillis":1722674437153,"checksum":"45e19250c6a2ded80ed14b5aca7a6ee4","clusterMap":{},"empty":true}2024-08-03 16:40:37,251 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:createServiceIfAbsent:491] createServiceIfAbsent end getClusterMap {}2024-08-03 16:40:37,251 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:652] addInstance key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday2024-08-03 16:40:37,252 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:806] updateIpAddresses before currentIPs:[],instanceMap:{}2024-08-03 16:40:37,257 WARN [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:815] cluster: beijing not found, ip: {"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722674437147,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}, will create new cluster with default configuration.2024-08-03 16:40:37,259 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:839] updateIpAddresses after currentIPs:[],instanceMap:{10.6.33.23:8064:unknown:beijing=10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing}2024-08-03 16:40:37,259 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:661] addInstance after addIpAddresses new instanceList:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing]2024-08-03 16:40:37,259 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:put:108] distro put key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday,value:{"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722674437147,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]}2024-08-03 16:40:37,260 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:onPut:132] createServiceIfAbsent start dataStore {}2024-08-03 16:40:37,260 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:onPut:141] createServiceIfAbsent end dataStore {com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday=com.alibaba.nacos.naming.consistency.Datum@72f532aa}2024-08-03 16:40:37,263 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:onChange:178] [NACOS-RAFT] datum service is changed, key: com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday, value: {"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722674437147,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]}2024-08-03 16:40:37,263 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:updateIPs:237] updateIPs before, instances: [10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing], ephemeral: true2024-08-03 16:40:37,264 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Cluster:updateIps:277] mall@@joyday {SYNC} {IP-NEW} cluster: beijing, new ips size: 1, content: [10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing]2024-08-03 16:40:37,266 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:updateIPs:290] [IP-UPDATED] namespace: public, service: mall@@joyday, ips: 10.6.33.23:8064_true,2024-08-03 16:40:37,269 DEBUG [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:recalculateChecksum:549] service to json: {"invalidIPCount":0,"name":"mall@@joyday","ipCount":1,"owners":[],"protectThreshold":0.0,"clusters":[{"healthChecker":{},"defIPPort":80,"defCkport":80,"name":"beijing","useIPPort4Check":true,"sitegroup":""}]}2024-08-03 16:40:37,269 DEBUG [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl$Notifier:handle:447] [NACOS-DISTRO] datum change notified, key: com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday, listener count: 1, action: CHANGE2024-08-03 16:40:38,267 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:127] mall@@joyday is changed, add it to push queue.2024-08-03 16:40:38,272 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:166] serviceName: mall@@joyday changed, schedule push for: 10.6.33.23:62522, agent: Nacos-Java-Client:v1.4.2, key: 10.6.33.23,62522,3735031098179002024-08-03 16:40:38,272 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:udpPush:614] send udp packet: 10.6.33.23,62522,3735031098179002024-08-03 16:40:38,278 INFO [com.alibaba.nacos.naming.push.receiver] [com.alibaba.nacos.naming.push.PushService$Receiver:run:687] received ack: {"type": "push-ack", "lastRefTime":"373503109817900", "data":""} from: 10.6.33.23:62522, cost: 6 ms, unacked: 0, total push: 1
dataStore-dataTum
key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday
{com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday
com.alibaba.nacos.naming.consistency.Datum@72f532aa}
{"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722674437147,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]
}
servicemap结构
{public={mall@@joyday=Service{name=‘mall@@joyday’, protectThreshold=0.0, appName=‘null’, groupName=‘mall’, metadata={}}}}
16.第二次8066服务启动日志
2024-08-03 16:53:45,870 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.core.ServiceManager:createServiceIfAbsent:492] createServiceIfAbsent end getClusterMap {beijing=com.alibaba.nacos.naming.core.Cluster@f27590dd}2024-08-03 16:53:45,870 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:653] addInstance key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday2024-08-03 16:53:45,870 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:656] addInstance ,serviceMap:{public={mall@@joyday=Service{name='mall@@joyday', protectThreshold=0.0, appName='null', groupName='mall', metadata={}}}}2024-08-03 16:53:45,871 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:809] updateIpAddresses before currentIPs:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing],instanceMap:{10.6.33.23:8064:unknown:beijing=10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing}2024-08-03 16:53:45,871 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:842] updateIpAddresses after currentIPs:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing],instanceMap:{10.6.33.23:8064:unknown:beijing=10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing=10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing}2024-08-03 16:53:45,872 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:664] addInstance after addIpAddresses new instanceList:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing]2024-08-03 16:53:45,872 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:put:108] distro put key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday,value:{"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://10.6.33.23:20880/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=joyday&bind.ip=10.6.33.23&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=joyday&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=38352&qos.enable=false&release=2.7.8&revision=2.2.6.RELEASE&side=provider×tamp=1722675134397&version=1.0.0" ]","dubbo.metadata.revision":"0","preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675221548,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000},{"instanceId":"10.6.33.23#8066#beijing#mall@@joyday","ip":"10.6.33.23","port":8066,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675225870,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]}2024-08-03 16:53:45,872 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:onPut:132] createServiceIfAbsent start dataStore {com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday=com.alibaba.nacos.naming.consistency.Datum@41cab4c3}2024-08-03 16:53:45,872 INFO [http-nio-8848-exec-6] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:onPut:141] createServiceIfAbsent end dataStore {com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday=com.alibaba.nacos.naming.consistency.Datum@36aea586}2024-08-03 16:53:45,872 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:onChange:178] [NACOS-RAFT] datum service is changed, key: com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday, value: {"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://10.6.33.23:20880/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=joyday&bind.ip=10.6.33.23&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=joyday&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=38352&qos.enable=false&release=2.7.8&revision=2.2.6.RELEASE&side=provider×tamp=1722675134397&version=1.0.0" ]","dubbo.metadata.revision":"0","preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675221548,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000},{"instanceId":"10.6.33.23#8066#beijing#mall@@joyday","ip":"10.6.33.23","port":8066,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675225870,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]}2024-08-03 16:53:45,873 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:updateIPs:237] updateIPs before, instances: [10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing], ephemeral: true2024-08-03 16:53:45,873 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Cluster:updateIps:277] mall@@joyday {SYNC} {IP-NEW} cluster: beijing, new ips size: 1, content: [10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing]2024-08-03 16:53:45,873 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:updateIPs:290] [IP-UPDATED] namespace: public, service: mall@@joyday, ips: 10.6.33.23:8064_true,10.6.33.23:8066_true,2024-08-03 16:53:45,873 DEBUG [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:recalculateChecksum:549] service to json: {"invalidIPCount":0,"name":"mall@@joyday","ipCount":2,"owners":[],"protectThreshold":0.0,"clusters":[{"healthChecker":{},"defIPPort":80,"defCkport":80,"name":"beijing","useIPPort4Check":true,"sitegroup":""}]}2024-08-03 16:53:45,873 DEBUG [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl$Notifier:handle:447] [NACOS-DISTRO] datum change notified, key: com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday, listener count: 1, action: CHANGE2024-08-03 16:53:46,566 DEBUG [http-nio-8848-exec-8] [com.alibaba.nacos.naming.controllers.InstanceController:beat:494] [CLIENT-BEAT] full arguments: beat: null, serviceName: mall@@joyday2024-08-03 16:53:46,878 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:127] mall@@joyday is changed, add it to push queue.2024-08-03 16:53:46,879 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:166] serviceName: mall@@joyday changed, schedule push for: 10.6.33.23:53206, agent: Nacos-Java-Client:v1.4.2, key: 10.6.33.23,53206,3742917143065002024-08-03 16:53:46,879 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:udpPush:614] send udp packet: 10.6.33.23,53206,3742917143065002024-08-03 16:53:46,880 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:166] serviceName: mall@@joyday changed, schedule push for: 10.6.33.23:62806, agent: Nacos-Java-Client:v1.4.2, key: 10.6.33.23,62806,3742917143065002024-08-03 16:53:46,881 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:udpPush:614] send udp packet: 10.6.33.23,62806,3742917143065002024-08-03 16:53:46,885 INFO [com.alibaba.nacos.naming.push.receiver] [com.alibaba.nacos.naming.push.PushService$Receiver:run:687] received ack: {"type": "push-ack", "lastRefTime":"374291714306500", "data":""} from: 10.6.33.23:62806, cost: 4 ms, unacked: 1, total push: 42024-08-03 16:53:46,885 INFO [com.alibaba.nacos.naming.push.receiver] [com.alibaba.nacos.naming.push.PushService$Receiver:run:687] received ack: {"type": "push-ack", "lastRefTime":"374291714306500", "data":""} from: 10.6.33.23:53206, cost: 6 ms, unacked: 0, total push: 42024-08-03 16:53:47,494 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.core.ServiceManager:createServiceIfAbsent:492] createServiceIfAbsent end getClusterMap {beijing=com.alibaba.nacos.naming.core.Cluster@f27590dd}2024-08-03 16:53:47,494 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:653] addInstance key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday2024-08-03 16:53:47,495 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:656] addInstance ,serviceMap:{public={mall@@joyday=Service{name='mall@@joyday', protectThreshold=0.0, appName='null', groupName='mall', metadata={}}}}2024-08-03 16:53:47,495 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:809] updateIpAddresses before currentIPs:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing],instanceMap:{10.6.33.23:8064:unknown:beijing=10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing=10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing}2024-08-03 16:53:47,496 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:842] updateIpAddresses after currentIPs:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing],instanceMap:{10.6.33.23:8064:unknown:beijing=10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing=10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing}2024-08-03 16:53:47,496 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.core.ServiceManager:addInstance:664] addInstance after addIpAddresses new instanceList:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing]2024-08-03 16:53:47,496 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:put:108] distro put key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday,value:{"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://10.6.33.23:20880/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=joyday&bind.ip=10.6.33.23&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=joyday&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=38352&qos.enable=false&release=2.7.8&revision=2.2.6.RELEASE&side=provider×tamp=1722675134397&version=1.0.0" ]","dubbo.metadata.revision":"0","preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675226566,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000},{"instanceId":"10.6.33.23#8066#beijing#mall@@joyday","ip":"10.6.33.23","port":8066,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://10.6.33.23:20881/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=joyday&bind.ip=10.6.33.23&bind.port=20881&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=joyday&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=44484&qos.enable=false&release=2.7.8&revision=2.2.6.RELEASE&side=provider×tamp=1722675226758&version=1.0.0" ]","dubbo.metadata.revision":"0","preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675227493,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]}2024-08-03 16:53:47,496 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:onPut:132] createServiceIfAbsent start dataStore {com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday=com.alibaba.nacos.naming.consistency.Datum@36aea586}2024-08-03 16:53:47,497 INFO [http-nio-8848-exec-9] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl:onPut:141] createServiceIfAbsent end dataStore {com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday=com.alibaba.nacos.naming.consistency.Datum@6ee0d505}2024-08-03 16:53:47,497 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:onChange:178] [NACOS-RAFT] datum service is changed, key: com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday, value: {"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://10.6.33.23:20880/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=joyday&bind.ip=10.6.33.23&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=joyday&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=38352&qos.enable=false&release=2.7.8&revision=2.2.6.RELEASE&side=provider×tamp=1722675134397&version=1.0.0" ]","dubbo.metadata.revision":"0","preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675226566,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000},{"instanceId":"10.6.33.23#8066#beijing#mall@@joyday","ip":"10.6.33.23","port":8066,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://10.6.33.23:20881/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=joyday&bind.ip=10.6.33.23&bind.port=20881&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=joyday&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=44484&qos.enable=false&release=2.7.8&revision=2.2.6.RELEASE&side=provider×tamp=1722675226758&version=1.0.0" ]","dubbo.metadata.revision":"0","preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675227493,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]}2024-08-03 16:53:47,497 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:updateIPs:237] updateIPs before, instances: [10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing], ephemeral: true2024-08-03 16:53:47,497 INFO [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:updateIPs:290] [IP-UPDATED] namespace: public, service: mall@@joyday, ips: 10.6.33.23:8064_true,10.6.33.23:8066_true,2024-08-03 16:53:47,498 DEBUG [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.core.Service:recalculateChecksum:549] service to json: {"invalidIPCount":0,"name":"mall@@joyday","ipCount":2,"owners":[],"protectThreshold":0.0,"clusters":[{"healthChecker":{},"defIPPort":80,"defCkport":80,"name":"beijing","useIPPort4Check":true,"sitegroup":""}]}2024-08-03 16:53:47,498 DEBUG [com.alibaba.nacos.naming.distro.notifier.0] [com.alibaba.nacos.naming.consistency.ephemeral.distro.DistroConsistencyServiceImpl$Notifier:handle:447] [NACOS-DISTRO] datum change notified, key: com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday, listener count: 1, action: CHANGE2024-08-03 16:53:47,674 DEBUG [com.alibaba.nacos.naming.service.worker.0] [com.alibaba.nacos.naming.core.Service:recalculateChecksum:549] service to json: {"invalidIPCount":0,"name":"mall@@joyday","ipCount":2,"owners":[],"protectThreshold":0.0,"clusters":[{"healthChecker":{},"defIPPort":80,"defCkport":80,"name":"beijing","useIPPort4Check":true,"sitegroup":""}]}2024-08-03 16:53:48,501 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:127] mall@@joyday is changed, add it to push queue.2024-08-03 16:53:48,501 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:166] serviceName: mall@@joyday changed, schedule push for: 10.6.33.23:53206, agent: Nacos-Java-Client:v1.4.2, key: 10.6.33.23,53206,3742933364654002024-08-03 16:53:48,501 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:udpPush:614] send udp packet: 10.6.33.23,53206,3742933364654002024-08-03 16:53:48,502 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:lambda$onApplicationEvent$1:166] serviceName: mall@@joyday changed, schedule push for: 10.6.33.23:62806, agent: Nacos-Java-Client:v1.4.2, key: 10.6.33.23,62806,3742933364654002024-08-03 16:53:48,502 INFO [com.alibaba.nacos.naming.push.udpSender.0] [com.alibaba.nacos.naming.push.PushService:udpPush:614] send udp packet: 10.6.33.23,62806,3742933364654002024-08-03 16:53:48,504 INFO [com.alibaba.nacos.naming.push.receiver] [com.alibaba.nacos.naming.push.PushService$Receiver:run:687] received ack: {"type": "push-ack", "lastRefTime":"374293336465400", "data":""} from: 10.6.33.23:53206, cost: 3 ms, unacked: 1, total push: 62024-08-03 16:53:48,505 INFO [com.alibaba.nacos.naming.push.receiver] [com.alibaba.nacos.naming.push.PushService$Receiver:run:687] received ack: {"type": "push-ack", "lastRefTime":"374293336465400", "data":""} from: 10.6.33.23:62806, cost: 3 ms, unacked: 0, total push: 62024-08-03 16:53:51,570 DEBUG [http-nio-8848-exec-4] [com.alibaba.nacos.naming.controllers.InstanceController:beat:494] [CLIENT-BEAT] full arguments: beat: null, serviceName: mall@@joyday2024-08-03 16:53:52,685 DEBUG [com.alibaba.nacos.naming.service.worker.0] [com.alibaba.nacos.naming.core.Service:recalculateChecksum:549] service to json: {"invalidIPCount":0,"name":"mall@@joyday","ipCount":2,"owners":[],"protectThreshold":0.0,"clusters":[{"healthChecker":{},"defIPPort":80,"defCkport":80,"name":"beijing","useIPPort4Check":true,"sitegroup":""}]}
updateIpAddresses after currentIPs:[10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing],instanceMap:{10.6.33.23:8064:unknown:beijing=10.6.33.23:8064:unknown:beijing_1.0_true_false_beijing, 10.6.33.23:8066:unknown:beijing=10.6.33.23:8066:unknown:beijing_1.0_true_false_beijing}
可以看到经过updateIpAddresses 多了一个实例,
最终写入distro后,也会多了一个实例
distro put key:com.alibaba.nacos.naming.iplist.ephemeral.public##mall@@joyday,value:
{"instanceList":[{"instanceId":"10.6.33.23#8064#beijing#mall@@joyday","ip":"10.6.33.23","port":8064,"weight":1,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"dubbo.metadata-service.urls":"[ "dubbo://10.6.33.23:20880/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=joyday&bind.ip=10.6.33.23&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=joyday&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=38352&qos.enable=false&release=2.7.8&revision=2.2.6.RELEASE&side=provider×tamp=1722675134397&version=1.0.0" ]","dubbo.metadata.revision":"0","preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675221548,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000},{"instanceId":"10.6.33.23#8066#beijing#mall@@joyday","ip":"10.6.33.23","port":8066,"weight":1,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"beijing","serviceName":"mall@@joyday","metadata":{"preserved.register.source":"SPRING_CLOUD"},"lastBeat":1722675225870,"marked":false,"app":"unknown","instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]
}
三、注册表数据结构
1.数据结构思维导图