alex8224 edited a comment on issue #5706:
URL: https://github.com/apache/apisix/issues/5706#issuecomment-988023902


   @tzssangglass 
   **If so, that's pretty good**
   
   Generally use the 
127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=xxx&namespaceId=dev 
interface to get all service instances under a namespaceId, The output of the 
interface call is as follows
   
   ```json
   {
      "allIPs":false,
      "cacheMillis":10000,
      "checksum":"",
      "clusters":"",
      "groupName":"DEFAULT_GROUP",
      "hosts":[
         {
            "clusterName":"DEFAULT",
            "enabled":true,
            "ephemeral":true,
            "healthy":true,
            "instanceHeartBeatInterval":5000,
            "instanceHeartBeatTimeOut":15000,
            "instanceId":"192.26.0.7#9088#DEFAULT#DEFAULT_GROUP@@xxx",
            "ip":"192.26.0.7",
            "ipDeleteTimeout":30000,
            "metadata":{
               "app.name":"xxx",
               "preserved.register.source":"SPRING_CLOUD",
               "startup.time":"1638849194096",
               "dept":"HR"
            },
            "port":9088,
            "serviceName":"DEFAULT_GROUP@@xxx",
            "weight":1.0
         },
         {
            "clusterName":"DEFAULT",
            "enabled":true,
            "ephemeral":true,
            "healthy":true,
            "instanceHeartBeatInterval":5000,
            "instanceHeartBeatTimeOut":15000,
            "instanceId":"192.26.0.6#9088#DEFAULT#DEFAULT_GROUP@@xxx",
            "ip":"192.26.0.6",
            "ipDeleteTimeout":30000,
            "metadata":{
               "app.name":"xxx",
               "preserved.register.source":"SPRING_CLOUD",
               "startup.time":"1638849194096",
               "dept":"IT"
            },
            "port":9088,
            "serviceName":"DEFAULT_GROUP@@xxx",
            "weight":1.0
         },
         {
            "clusterName":"DEFAULT",
            "enabled":true,
            "ephemeral":true,
            "healthy":true,
            "instanceHeartBeatInterval":5000,
            "instanceHeartBeatTimeOut":15000,
            "instanceId":"192.26.0.9#9088#DEFAULT#DEFAULT_GROUP@@xxx",
            "ip":"192.26.0.9",
            "ipDeleteTimeout":30000,
            "metadata":{
               "app.name":"xxx",
               "preserved.register.source":"SPRING_CLOUD",
               "startup.time":"1638849194096",
               "dept":"HRP"
            },
            "port":9088,
            "serviceName":"DEFAULT_GROUP@@xxx",
            "weight":1.0
         }
      ],
      "lastRefTime":1638890095796,
      "name":"DEFAULT_GROUP@@bcs-server",
      "reachProtectionThreshold":false,
      "valid":true
   }```
   
   
   
   There are several scenarios as follows
   route url = /xxx/*
   When the client requests /xxx/*
   When header ["X-Real-Ip"] between ["192.168.1-192.168.1.10"], the request is 
routed to the instance node with metadata field dept == HR, in this case node 
192.26.0.7
   Other requests that do not match are routed to nodes that do not match, in 
this case to 192.26.0.6 and 192.26.0.9
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to