吐槽下Nacos服务发现

Posted 流子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了吐槽下Nacos服务发现相关的知识,希望对你有一定的参考价值。

1.注销实例的API或者SDK(deregisterInstance),会导致该条记录消失,如果只是modifyinstance,会导致永远驻留在数据中

2.游戏区做了迁移或者IP漂移的话,老的脏数据还是会在服务器列表里,没法通过zoneid去覆盖,只能通过人工去把该节点下线

3.目前为了减少线程占用,dir和game的底层用的是nacos API,基于http client封装,但为了实时同步(subscribe),dir服又同时用了nacos SDK

4.用Nacos SDK 的话,进程会新增10几个线程

5.每次有区服更新,会导致全量同步

  1. 同步时冗余数据过多

    "name":"game@@game",
    "groupName":"game",
    "clusters":"game",
    "cacheMillis":10000,
    "hosts":[
        
            "instanceId":"░░░░░░░░░░░#8888#game#game@@game",
            "ip":"░░░░░░░░░░░",
            "port":8888,
            "weight":1,
            "healthy":true,
            "enabled":true,
            "ephemeral":true,
            "clusterName":"game",
            "serviceName":"game@@game",
            "metadata":
                "serverVersion":"0.0.1-433d9d4[1801]-S20210910R1",
                "debug":"true",
                "envNamespace":"idc-test",
                "worldId":"1",
                "type":"game",
                "tcpPort":"8888",
                "innerPort":"9527",
                "instanceId":"1",
                "serverType":"2",
                "name":"master服",
                "startTime":"2021-09-10 10:59:24",
                "id":"1",
                "innerIp":"░░░░░░░░░░░",
                "externalIp":"░░░░░░░░░░░",
                "webPort":"10086",
                "status":"0"
            ,
            "instanceHeartBeatInterval":5000,
            "instanceHeartBeatTimeOut":15000,
            "ipDeleteTimeout":30000
        ,
 
        
            "instanceId":"░░░░░░░░░░░#8888#game#game@@game",
            "ip":"░░░░░░░░░░░,
            "port":8888,
            "weight":1,
            "healthy":true,
            "enabled":true,
            "ephemeral":true,
            "clusterName":"game",
            "serviceName":"game@@game",
            "metadata":
                "serverVersion":"0.0.1-d14d1c9[1792]-S20210909R1",
                "debug":"true",
                "envNamespace":"idc-test",
                "worldId":"2",
                "type":"game",
                "tcpPort":"8888",
                "innerPort":"9527",
                "instanceId":"0",
                "serverType":"0",
                "name":"idc-weekly服",
                "startTime":"2021-09-09 23:04:43",
                "id":"2",
                "innerIp":"░░░░░░░░░░░",
                "externalIp":"░░░░░░░░░░░",
                "webPort":"10086",
                "status":"0"
            ,
            "instanceHeartBeatInterval":5000,
            "instanceHeartBeatTimeOut":15000,
            "ipDeleteTimeout":30000
        ,
        
            "instanceId":"░░░░░░░░░░░#8888#game#game@@game",
            "ip":"░░░░░░░░░░░",
            "port":8888,
            "weight":1,
            "healthy":true,
            "enabled":true,
            "ephemeral":true,
            "clusterName":"game",
            "serviceName":"game@@game",
            "metadata":
                "serverVersion":"0.0.1-d14d1c9[1792]-S20210909R1",
                "debug":"true",
                "envNamespace":"idc-test",
                "worldId":"1",
                "type":"game",
                "tcpPort":"8888",
                "innerPort":"9527",
                "instanceId":"0",
                "serverType":"0",
                "name":"idc-jsq服",
                "startTime":"2021-09-09 22:13:23",
                "id":"3",
                "innerIp":"░░░░░░░░░░░",
                "externalIp":"░░░░░░░░░░░",
                "webPort":"10086",
                "status":"0"
            ,
            "instanceHeartBeatInterval":5000,
            "instanceHeartBeatTimeOut":15000,
            "ipDeleteTimeout":30000
        
    ],
    "lastRefTime":1631243287693,
    "checksum":"",
    "allIPs":false,
    "reachProtectionThreshold":false,
    "valid":true

以上是关于吐槽下Nacos服务发现的主要内容,如果未能解决你的问题,请参考以下文章

吐槽下Nacos服务发现

吐槽下Nacos服务发现

用了 CSDN 的 markdown 编辑器吐槽下~~

微服务之吐槽一下Nacos日志的疯狂输出

2019工作总结

不得不吐槽下愚蠢的代码编辑方式