2:通过 src host 本机ip && dst host 本机ip对抓到的包进行过滤。抓到包的截图如下:
从图中我们至少能很直观的得到两个信息:
Get接口用于请求注册中心目前有那些服务提供者,请求的接口url如下图所示:
返回的结果是json格式的数据,数据信息如下:
{
"applications": {
"versions__delta": "1",
"apps__hashcode": "UP_2_",
"application": [
{
"name": "CONSUMER",
"instance": [
{
"instanceId": "021ZJ1705.synacast.local:consumer:9000",
"hostName": "10.200.121.41",
"app": "CONSUMER",
"ipAddr": "10.200.121.41",
"status": "UP",
"overriddenstatus": "UNKNOWN",
"port": {
"$": 9000,
"@enabled": "true"
},
"securePort": {
"$": 443,
"@enabled": "false"
},
"countryId": 1,
"dataCenterInfo": {
"@class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
"name": "MyOwn"
},
"leaseInfo": {
"renewalIntervalInSecs": 30,
"durationInSecs": 90,
"registrationTimestamp": 1530688491242,
"lastRenewalTimestamp": 1530689331391,
"evictionTimestamp": 0,
"serviceUpTimestamp": 1530688490719
},
"metadata": {
"management.port": "9000",
"jmx.port": "64966"
},
"homePageUrl": "http://10.200.121.41:9000/",
"statusPageUrl": "http://10.200.121.41:9000/info",
"healthCheckUrl": "http://10.200.121.41:9000/health",
"vipAddress": "consumer",
"secureVipAddress": "consumer",
"isCoordinatingDiscoveryServer": "false",
"lastUpdatedTimestamp": "1530688491242",
"lastDirtyTimestamp": "1530688490594",
"actionType": "ADDED"
}
]
},
{
"name": "PROVIDER",
"instance": [
{
"instanceId": "021ZJ1705.synacast.local:provider:8000",
"hostName": "10.200.121.41",
"app": "PROVIDER",
"ipAddr": "10.200.121.41",
"status": "UP",
"overriddenstatus": "UNKNOWN",
"port": {
"$": 8000,
"@enabled": "true"
},
"securePort": {
"$": 443,
"@enabled": "false"
},
"countryId": 1,
"dataCenterInfo": {
"@class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
"name": "MyOwn"
},
"leaseInfo": {
"renewalIntervalInSecs": 30,
"durationInSecs": 90,
"registrationTimestamp": 1530686242737,
"lastRenewalTimestamp": 1530689333558,
"evictionTimestamp": 0,
"serviceUpTimestamp": 1530686242111
},
"metadata": {
"management.port": "8000",
"jmx.port": "63616"
},
"homePageUrl": "http://10.200.121.41:8000/",
"statusPageUrl": "http://10.200.121.41:8000/info",
"healthCheckUrl": "http://10.200.121.41:8000/health",
"vipAddress": "provider",
"secureVipAddress": "provider",
"isCoordinatingDiscoveryServer": "false",
"lastUpdatedTimestamp": "1530686242737",
"lastDirtyTimestamp": "1530686241987",
"actionType": "ADDED"
}
]
}
]
}
}
注:如果Eureka客户端每次请求都取得所有服务提供者的所有信息,会给Eureka Server服务器带来访问压力。Eureka服务器提供了增量获取数据的接口,接口信息如下图所示:
用于提交系统当前服务信息到Eureak Server,请求的url信息如下图:
提交的json结构如下:
{
"instance": {
"instanceId": "021ZJ1705.synacast.local:consumer:9000",
"hostName": "10.200.121.41",
"app": "CONSUMER",
"ipAddr": "10.200.121.41",
"status": "UP",
"overriddenstatus": "UNKNOWN",
"port": {
"$": 9000,
"@enabled": "true"
},
"securePort": {
"$": 443,
"@enabled": "false"
},
"countryId": 1,
"dataCenterInfo": {
"@class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
"name": "MyOwn"
},
"leaseInfo": {
"renewalIntervalInSecs": 30,
"durationInSecs": 90,
"registrationTimestamp": 0,
"lastRenewalTimestamp": 0,
"evictionTimestamp": 0,
"serviceUpTimestamp": 0
},
"metadata": {
"management.port": "9000",
"jmx.port": "64966"
},
"homePageUrl": "http://10.200.121.41:9000/",
"statusPageUrl": "http://10.200.121.41:9000/info",
"healthCheckUrl": "http://10.200.121.41:9000/health",
"vipAddress": "consumer",
"secureVipAddress": "consumer",
"isCoordinatingDiscoveryServer": "false",
"lastUpdatedTimestamp": "1530688489595",
"lastDirtyTimestamp": "1530688490594"
}
}
Put方法请求用于维持服务提供者与Eureka Server的心跳服务,请求的信息如下图:
请求的URL 里包括 application.name信息,服务的URL,状态信息与最后的更新时间。