nacos服务注册流程

打印 上一主题 下一主题

主题 739|帖子 739|积分 2217

一、客户端主动注册实例流程

1.首先客户端必要引入服务发现包

  1.   <groupId>com.alibaba.cloud</groupId>
  2.   <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
  3.   <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

  1. public String reqApi(String api, Map<String, String> params, Map<String, String> body, List<String> servers,
  2.             String method) throws NacosException {
  3.         
  4.         params.put(CommonParams.NAMESPACE_ID, getNamespaceId());
  5.         
  6.         if (CollectionUtils.isEmpty(servers) && StringUtils.isBlank(nacosDomain)) {
  7.             throw new NacosException(NacosException.INVALID_PARAM, "no server available");
  8.         }
  9.         
  10.         NacosException exception = new NacosException();
  11.         
  12.         if (StringUtils.isNotBlank(nacosDomain)) {
  13.             for (int i = 0; i < maxRetry; i++) {
  14.                 try {
  15.                     return callServer(api, params, body, nacosDomain, method);
  16.                 } catch (NacosException e) {
  17.                     exception = e;
  18.                     if (NAMING_LOGGER.isDebugEnabled()) {
  19.                         NAMING_LOGGER.debug("request {} failed.", nacosDomain, e);
  20.                     }
  21.                 }
  22.             }
  23.         } else {
  24.             Random random = new Random(System.currentTimeMillis());
  25.             int index = random.nextInt(servers.size());
  26.             
  27.             for (int i = 0; i < servers.size(); i++) {
  28.                 String server = servers.get(index);
  29.                 try {
  30.                     return callServer(api, params, body, server, method);
  31.                 } catch (NacosException e) {
  32.                     exception = e;
  33.                     if (NAMING_LOGGER.isDebugEnabled()) {
  34.                         NAMING_LOGGER.debug("request {} failed.", server, e);
  35.                     }
  36.                 }
  37.                 index = (index + 1) % servers.size();
  38.             }
  39.         }
  40.         
  41.         NAMING_LOGGER.error("request: {} failed, servers: {}, code: {}, msg: {}", api, servers, exception.getErrCode(),
  42.                 exception.getErrMsg());
  43.         
  44.         throw new NacosException(exception.getErrCode(),
  45.                 "failed to req API:" + api + " after all servers(" + servers + ") tried: " + exception.getMessage());
  46.         
  47.     }
  48.    
复制代码
如果是带域名,或者单机运行,则直接发起HTTP调用,如果是集群NACOS服务列表,则随机找到一台NACOS服务器发起请求。

12.客户端注册完成

二、服务端注册流程

1.下载1.4.2源码,本地启动

-Dnacos.standalone=true -Dnacos.home=e:\\nacos
启动类为com.alibaba.nacos.Nacos
2.服务端是SPRINGBOOT项目,找到控制器接口


3.首先辈入InstanceController.register


4.进入ServiceManager.register,此类就是客户端服务实例的管理类,保存客户端实例的注册表。

  1. @Component
  2. public class ServiceManager implements RecordListener<Service> {
  3.    
  4.     /**
  5.      * Map(namespace, Map(group::serviceName, Service)). 真正的注册表
  6.      */
  7.     private final Map<String, Map<String, Service>> serviceMap = new ConcurrentHashMap<>();
  8.    
  9.     private final LinkedBlockingDeque<ServiceKey> toBeUpdatedServicesQueue = new LinkedBlockingDeque<>(1024 * 1024);
  10.    
  11.     private final Synchronizer synchronizer = new ServiceStatusSynchronizer();
  12.    
  13.     private final Lock lock = new ReentrantLock();
  14.    
  15.     @Resource(name = "consistencyDelegate")
  16.     //一致性协调协议
  17.     private ConsistencyService consistencyService;
  18.    
  19.     private final SwitchDomain switchDomain;
  20.    
  21.     private final DistroMapper distroMapper;
  22.    
  23.     private final ServerMemberManager memberManager;
  24.    
  25.     private final PushService pushService;
  26.    
  27.     private final RaftPeerSet raftPeerSet;
复制代码
5.如果服务不存在,则会创建一个空的Service对象。


注意,此时的servicename已经带了分组了。
6.调试日志输出品级

由于服务端源码有多个线程协作,调试比力贫苦,发起看代码,然后加日志打印输出。
可以把naming的LOGBACK日志输出品级调成DEBUG
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.   ~ Copyright 1999-2018 Alibaba Group Holding Ltd.
  4.   ~
  5.   ~ Licensed under the Apache License, Version 2.0 (the "License");
  6.   ~ you may not use this file except in compliance with the License.
  7.   ~ You may obtain a copy of the License at
  8.   ~
  9.   ~      http://www.apache.org/licenses/LICENSE-2.0
  10.   ~
  11.   ~ Unless required by applicable law or agreed to in writing, software
  12.   ~ distributed under the License is distributed on an "AS IS" BASIS,
  13.   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   ~ See the License for the specific language governing permissions and
  15.   ~ limitations under the License.
  16.   -->
  17. <included>
  18.     <springProperty scope="context" name="logPath" source="nacos.logs.path" defaultValue="${user.home}/nacos/logs"/>
  19.     <property name="LOG_HOME" value="${logPath}"/>
  20.     <appender name="naming-server"
  21.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  22.         <file>${LOG_HOME}/naming-server.log</file>
  23.         <append>true</append>
  24.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  25.             <fileNamePattern>${LOG_HOME}/naming-server.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  26.             <maxFileSize>2GB</maxFileSize>
  27.             <maxHistory>15</maxHistory>
  28.             <totalSizeCap>7GB</totalSizeCap>
  29.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  30.         </rollingPolicy>
  31.         <encoder>
  32.             <Pattern>%date %level  [%C:%M:%L] %msg%n%n</Pattern>
  33.             <charset>UTF-8</charset>
  34.         </encoder>
  35.     </appender>
  36.     <appender name="naming-raft"
  37.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  38.         <file>${LOG_HOME}/naming-raft.log</file>
  39.         <append>true</append>
  40.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  41.             <fileNamePattern>${LOG_HOME}/naming-raft.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  42.             <maxFileSize>20MB</maxFileSize>
  43.             <maxHistory>15</maxHistory>
  44.             <totalSizeCap>128MB</totalSizeCap>
  45.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  46.         </rollingPolicy>
  47.         <encoder>
  48.             <Pattern>%date %level  [%C:%M:%L] %msg%n%n</Pattern>
  49.             <charset>UTF-8</charset>
  50.         </encoder>
  51.     </appender>
  52.     <appender name="naming-event"
  53.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  54.         <file>${LOG_HOME}/naming-event.log</file>
  55.         <append>true</append>
  56.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  57.             <fileNamePattern>${LOG_HOME}/naming-event.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  58.             <maxFileSize>20MB</maxFileSize>
  59.             <maxHistory>15</maxHistory>
  60.             <totalSizeCap>128MB</totalSizeCap>
  61.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  62.         </rollingPolicy>
  63.         <encoder>
  64.             <Pattern>%date %level [%C:%M:%L] %msg%n%n</Pattern>
  65.             <charset>UTF-8</charset>
  66.         </encoder>
  67.     </appender>
  68.     <appender name="naming-push"
  69.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  70.         <file>${LOG_HOME}/naming-push.log</file>
  71.         <append>true</append>
  72.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  73.             <fileNamePattern>${LOG_HOME}/naming-push.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  74.             <maxFileSize>20MB</maxFileSize>
  75.             <maxHistory>15</maxHistory>
  76.             <totalSizeCap>128MB</totalSizeCap>
  77.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  78.         </rollingPolicy>
  79.         <encoder>
  80.             <Pattern>%date %level  [%C:%M:%L] %msg%n%n</Pattern>
  81.             <charset>UTF-8</charset>
  82.         </encoder>
  83.     </appender>
  84.     <appender name="naming-rt"
  85.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  86.         <file>${LOG_HOME}/naming-rt.log</file>
  87.         <append>true</append>
  88.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  89.             <fileNamePattern>${LOG_HOME}/naming-rt.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  90.             <maxFileSize>1GB</maxFileSize>
  91.             <maxHistory>15</maxHistory>
  92.             <totalSizeCap>3GB</totalSizeCap>
  93.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  94.         </rollingPolicy>
  95.         <encoder>
  96.             <Pattern>%date %level  [%C:%M:%L] %msg%n%n</Pattern>
  97.             <charset>UTF-8</charset>
  98.         </encoder>
  99.     </appender>
  100.     <appender name="naming-performance"
  101.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  102.         <file>${LOG_HOME}/naming-performance.log</file>
  103.         <append>true</append>
  104.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  105.             <fileNamePattern>${LOG_HOME}/naming-performance.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  106.             <maxFileSize>50MB</maxFileSize>
  107.             <maxHistory>15</maxHistory>
  108.             <totalSizeCap>512MB</totalSizeCap>
  109.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  110.         </rollingPolicy>
  111.         <encoder>
  112.             <Pattern>%date %level  [%C:%M:%L] %msg%n%n</Pattern>
  113.             <charset>UTF-8</charset>
  114.         </encoder>
  115.     </appender>
  116.     <appender name="naming-router"
  117.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  118.         <file>${LOG_HOME}/naming-router.log</file>
  119.         <append>true</append>
  120.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  121.             <fileNamePattern>${LOG_HOME}/naming-router.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  122.             <maxFileSize>2GB</maxFileSize>
  123.             <maxHistory>15</maxHistory>
  124.             <totalSizeCap>7GB</totalSizeCap>
  125.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  126.         </rollingPolicy>
  127.         <encoder>
  128.             <Pattern>%date|%msg%n</Pattern>
  129.             <charset>UTF-8</charset>
  130.         </encoder>
  131.     </appender>
  132.     <appender name="naming-cache"
  133.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  134.         <file>${LOG_HOME}/naming-cache.log</file>
  135.         <append>true</append>
  136.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  137.             <fileNamePattern>${LOG_HOME}/naming-cache.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  138.             <maxFileSize>1GB</maxFileSize>
  139.             <maxHistory>15</maxHistory>
  140.             <totalSizeCap>3GB</totalSizeCap>
  141.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  142.         </rollingPolicy>
  143.         <encoder>
  144.             <Pattern>%date|%msg%n</Pattern>
  145.             <charset>UTF-8</charset>
  146.         </encoder>
  147.     </appender>
  148.     <appender name="naming-device"
  149.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  150.         <file>${LOG_HOME}/naming-device.log</file>
  151.         <append>true</append>
  152.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  153.             <fileNamePattern>${LOG_HOME}/naming-device.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  154.             <maxFileSize>2GB</maxFileSize>
  155.             <maxHistory>15</maxHistory>
  156.             <totalSizeCap>7GB</totalSizeCap>
  157.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  158.         </rollingPolicy>
  159.         <encoder>
  160.             <Pattern>%date|%msg%n</Pattern>
  161.             <charset>UTF-8</charset>
  162.         </encoder>
  163.     </appender>
  164.     <appender name="naming-tag"
  165.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  166.         <file>${LOG_HOME}/naming-tag.log</file>
  167.         <append>true</append>
  168.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  169.             <fileNamePattern>${LOG_HOME}/naming-tag.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  170.             <maxFileSize>1GB</maxFileSize>
  171.             <maxHistory>15</maxHistory>
  172.             <totalSizeCap>3GB</totalSizeCap>
  173.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  174.         </rollingPolicy>
  175.         <encoder>
  176.             <Pattern>%date %level %msg%n%n</Pattern>
  177.             <charset>UTF-8</charset>
  178.         </encoder>
  179.     </appender>
  180.     <appender name="naming-debug"
  181.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  182.         <file>${LOG_HOME}/naming-debug.log</file>
  183.         <append>true</append>
  184.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  185.             <fileNamePattern>${LOG_HOME}/naming-debug.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  186.             <maxFileSize>20MB</maxFileSize>
  187.             <maxHistory>15</maxHistory>
  188.             <totalSizeCap>128MB</totalSizeCap>
  189.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  190.         </rollingPolicy>
  191.         <encoder>
  192.             <Pattern>%date %level %msg%n%n</Pattern>
  193.             <charset>UTF-8</charset>
  194.         </encoder>
  195.     </appender>
  196.     <appender name="naming-distro"
  197.         class="ch.qos.logback.core.rolling.RollingFileAppender">
  198.         <file>${LOG_HOME}/naming-distro.log</file>
  199.         <append>true</append>
  200.         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  201.             <fileNamePattern>${LOG_HOME}/naming-distro.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
  202.             <maxFileSize>1GB</maxFileSize>
  203.             <maxHistory>7</maxHistory>
  204.             <totalSizeCap>3GB</totalSizeCap>
  205.             <cleanHistoryOnStart>true</cleanHistoryOnStart>
  206.         </rollingPolicy>
  207.         <encoder>
  208.             <Pattern>%date %level  [%C:%M:%L] %msg%n%n</Pattern>
  209.             <charset>UTF-8</charset>
  210.         </encoder>
  211.     </appender>
  212.     <appender name="CONSOLE2" class="ch.qos.logback.core.ConsoleAppender">
  213.         <encoder>
  214.             <Pattern>%date %level [%thread] [%C:%M:%L] %msg%n%n</Pattern>
  215.             <charset>UTF-8</charset>
  216.         </encoder>
  217.     </appender>
  218.     <logger name="com.alibaba.nacos.naming.main" additivity="false">
  219.         <level value="DEBUG"/>
  220.         <appender-ref ref="naming-server"/>
  221.         <appender-ref ref="CONSOLE2"/>
  222.     </logger>
  223.     <logger name="com.alibaba.nacos.naming.raft" additivity="false">
  224.         <level value="DEBUG"/>
  225.         <appender-ref ref="naming-raft"/>
  226.         <appender-ref ref="CONSOLE2"/>
  227.     </logger>
  228.     <logger name="com.alibaba.nacos.naming.distro" additivity="false">
  229.         <level value="DEBUG"/>
  230.         <appender-ref ref="naming-distro"/>
  231.         <appender-ref ref="CONSOLE2"/>
  232.     </logger>
  233.     <logger name="com.alibaba.nacos.naming.event" additivity="false">
  234.         <level value="DEBUG"/>
  235.         <appender-ref ref="naming-event"/>
  236.         <appender-ref ref="CONSOLE2"/>
  237.     </logger>
  238.     <logger name="com.alibaba.nacos.naming.push" additivity="false">
  239.         <level value="DEBUG"/>
  240.         <appender-ref ref="naming-push"/>
  241.         <appender-ref ref="CONSOLE2"/>
  242.     </logger>
  243.     <logger name="com.alibaba.nacos.naming.rt" additivity="false">
  244.         <level value="DEBUG"/>
  245.         <appender-ref ref="naming-rt"/>
  246.         <appender-ref ref="CONSOLE2"/>
  247.     </logger>
  248.     <logger name="com.alibaba.nacos.naming.performance" additivity="false">
  249.         <level value="DEBUG"/>
  250.         <appender-ref ref="naming-performance"/>
  251.     </logger>
  252.     <logger name="com.alibaba.nacos.naming.router" additivity="false">
  253.         <level value="DEBUG"/>
  254.         <appender-ref ref="naming-router"/>
  255.     </logger>
  256.     <logger name="com.alibaba.nacos.naming.cache" additivity="false">
  257.         <level value="DEBUG"/>
  258.         <appender-ref ref="naming-cache"/>
  259.     </logger>
  260.     <logger name="com.alibaba.nacos.naming.debug" additivity="false">
  261.         <level value="DEBUG"/>
  262.         <appender-ref ref="naming-debug"/>
  263.         <appender-ref ref="CONSOLE2"/>
  264.     </logger>
  265. </included>
复制代码
7.业务日志APPENDER类分析

有一个统一的日志输出类,将各种业务分别用差别的APPENDER对象输出
  1. public class Loggers {
  2.    
  3. //客户端推送
  4.     public static final Logger PUSH = LoggerFactory.getLogger("com.alibaba.nacos.naming.push");
  5.    
  6. //心跳检测
  7.     public static final Logger CHECK_RT = LoggerFactory.getLogger("com.alibaba.nacos.naming.rt");
  8.    
  9. //服务相关业务
  10.     public static final Logger SRV_LOG = LoggerFactory.getLogger("com.alibaba.nacos.naming.main");
  11.    
  12. //通知事件,如新服务注册,变更,下线等。
  13.     public static final Logger EVT_LOG = LoggerFactory.getLogger("com.alibaba.nacos.naming.event");
  14.    
  15. //一致性RAFT系统 CP
  16.     public static final Logger RAFT = LoggerFactory.getLogger("com.alibaba.nacos.naming.raft");
  17.    
  18. //一致性协议 ,AP
  19.     public static final Logger DISTRO = LoggerFactory.getLogger("com.alibaba.nacos.naming.distro");
  20.    
  21. //性能分析
  22.     public static final Logger PERFORMANCE_LOG = LoggerFactory.getLogger("com.alibaba.nacos.naming.performance");
复制代码
8.注册后的serviceMap布局如下:


单个Service的示例布局如下:
  1. {
  2.     "name":"mall@@joyday",
  3.     "protectThreshold":0,
  4.     "groupName":"mall",
  5.     "metadata":{
  6.     },
  7.     "finalizeCount":2,
  8.     "owners":[
  9.     ],
  10.     "resetWeight":false,
  11.     "enabled":true,
  12.     "selector":{
  13.         "type":"none"
  14.     },
  15.     "namespaceId":"public",
  16.     "ipDeleteTimeout":30000,
  17.     "lastModifiedMillis":1722671874301,
  18.     "checksum":"f936119262bea62fbfbb16c10f955e96",
  19.     "clusterMap":{
  20.         "beijing":{
  21.             "serviceName":"mall@@joyday",
  22.             "name":"beijing",
  23.             "healthChecker":{
  24.                 "type":"TCP"
  25.             },
  26.             "defaultPort":80,
  27.             "defaultCheckPort":80,
  28.             "useIPPort4Check":true,
  29.             "metadata":{
  30.             },
  31.             "sitegroup":"",
  32.             "defCkport":80,
  33.             "empty":false,
  34.             "defIPPort":80
  35.         }
  36.     },
  37.     "empty":false
  38. }
复制代码
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.
  1. updateIPs
复制代码

注意在这里,会给pushService发出关照,关照相干客户端此服务的实例发生厘革。

14.我们再启动一个新的实例,查看clusterMap,dataStore的厘革。看到端口酿成了8066


15.第一次8064服务启动日志
  1. 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@@joyday
  2. 2024-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@@joyday
  3. 2024-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":[]}
  4. 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@@joyday
  5. 2024-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}
  6. 2024-08-03 16:40:37,251 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:createServiceIfAbsent:491] createServiceIfAbsent end getClusterMap {}
  7. 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@@joyday
  8. 2024-08-03 16:40:37,252 INFO [http-nio-8848-exec-7] [com.alibaba.nacos.naming.core.ServiceManager:updateIpAddresses:806]  updateIpAddresses before  currentIPs:[],instanceMap:{}
  9. 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.
  10. 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}
  11. 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]
  12. 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}]}
  13. 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 {}
  14. 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}
  15. 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}]}
  16. 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: true
  17. 2024-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]
  18. 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,
  19. 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":""}]}
  20. 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: CHANGE
  21. 2024-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.
  22. 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,373503109817900
  23. 2024-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,373503109817900
  24. 2024-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}
  1. {
  2.     "instanceList":[
  3.         {
  4.             "instanceId":"10.6.33.23#8064#beijing#mall@@joyday",
  5.             "ip":"10.6.33.23",
  6.             "port":8064,
  7.             "weight":1,
  8.             "healthy":true,
  9.             "enabled":true,
  10.             "ephemeral":true,
  11.             "clusterName":"beijing",
  12.             "serviceName":"mall@@joyday",
  13.             "metadata":{
  14.                 "preserved.register.source":"SPRING_CLOUD"
  15.             },
  16.             "lastBeat":1722674437147,
  17.             "marked":false,
  18.             "app":"unknown",
  19.             "instanceHeartBeatInterval":5000,
  20.             "instanceHeartBeatTimeOut":15000,
  21.             "ipDeleteTimeout":30000
  22.         }
  23.     ]
  24. }
复制代码
servicemap布局
{public={mall@@joyday=Service{name='mall@@joyday', protectThreshold=0.0, appName='null', groupName='mall', metadata={}}}}
16.第二次8066服务启动日志
  1. 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}
  2. 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@@joyday
  3. 2024-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={}}}}
  4. 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}
  5. 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}
  6. 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]
  7. 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&timestamp=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}]}
  8. 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}
  9. 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}
  10. 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&timestamp=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}]}
  11. 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: true
  12. 2024-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]
  13. 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,
  14. 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":""}]}
  15. 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: CHANGE
  16. 2024-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@@joyday
  17. 2024-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.
  18. 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,374291714306500
  19. 2024-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,374291714306500
  20. 2024-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,374291714306500
  21. 2024-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,374291714306500
  22. 2024-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: 4
  23. 2024-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: 4
  24. 2024-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}
  25. 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@@joyday
  26. 2024-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={}}}}
  27. 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}
  28. 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}
  29. 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]
  30. 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&timestamp=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&timestamp=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}]}
  31. 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}
  32. 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}
  33. 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&timestamp=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&timestamp=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}]}
  34. 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: true
  35. 2024-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,
  36. 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":""}]}
  37. 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: CHANGE
  38. 2024-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":""}]}
  39. 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.
  40. 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,374293336465400
  41. 2024-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,374293336465400
  42. 2024-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,374293336465400
  43. 2024-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,374293336465400
  44. 2024-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: 6
  45. 2024-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: 6
  46. 2024-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@@joyday
  47. 2024-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:
  1. {
  2.     "instanceList":[
  3.         {
  4.             "instanceId":"10.6.33.23#8064#beijing#mall@@joyday",
  5.             "ip":"10.6.33.23",
  6.             "port":8064,
  7.             "weight":1,
  8.             "healthy":true,
  9.             "enabled":true,
  10.             "ephemeral":true,
  11.             "clusterName":"beijing",
  12.             "serviceName":"mall@@joyday",
  13.             "metadata":{
  14.                 "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" ]",
  15.                 "dubbo.metadata.revision":"0",
  16.                 "preserved.register.source":"SPRING_CLOUD"
  17.             },
  18.             "lastBeat":1722675221548,
  19.             "marked":false,
  20.             "app":"unknown",
  21.             "instanceHeartBeatInterval":5000,
  22.             "instanceHeartBeatTimeOut":15000,
  23.             "ipDeleteTimeout":30000
  24.         },
  25.         {
  26.             "instanceId":"10.6.33.23#8066#beijing#mall@@joyday",
  27.             "ip":"10.6.33.23",
  28.             "port":8066,
  29.             "weight":1,
  30.             "healthy":true,
  31.             "enabled":true,
  32.             "ephemeral":true,
  33.             "clusterName":"beijing",
  34.             "serviceName":"mall@@joyday",
  35.             "metadata":{
  36.                 "preserved.register.source":"SPRING_CLOUD"
  37.             },
  38.             "lastBeat":1722675225870,
  39.             "marked":false,
  40.             "app":"unknown",
  41.             "instanceHeartBeatInterval":5000,
  42.             "instanceHeartBeatTimeOut":15000,
  43.             "ipDeleteTimeout":30000
  44.         }
  45.     ]
  46. }
复制代码
三、注册表数据布局

1.数据布局思维导图


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

大连密封材料

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表