客户端服务实例id相同,被顶掉测试,服务被覆盖。
相同的服务,不同的名字,点开链接相同
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pyZwKbOr-1572017171267)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\1572016385206.png)]
如果所示,为不同名称的同一个服务,最新注册的服务为
UP (1) - 192.168.0.151:SERVICE-C1
所以先删除curl -X DELETE http://224:224@localhost:8888/eureka/apps/SERVICE-C1/192.168.0.151:SERVICE-C1:4444 发现只剩下192.168.0.151:SERVICE-C1服务了。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-W2w6fQpS-1572017171268)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\1572016549310.png)]
并且已经删除的服务因为服务名不会再通过心跳注册,所以,再也不会进入up状态。
在线关闭和启用客服端服务(需要zuul来验证) --分开启自我保护与非自我保护
黑名单测试
心跳测试
服务列表
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pQyZaPjS-1572017171268)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\1572015486767.png)]
curl http://224:224@localhost:8888/eureka/apps 查看服务信息
<applications>
<versions__delta>1</versions__delta>
<apps__hashcode>UP_1_</apps__hashcode>
<application>
<name>SERVICE-C1</name>
<instance>
<instanceId>192.168.0.151:SERVICE-C1:4444</instanceId>
<hostName>192.168.0.151</hostName>
<app>SERVICE-C1</app>
<ipAddr>192.168.0.151</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">4444</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1572015039634</registrationTimestamp>
<lastRenewalTimestamp>1572015399505</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1572015039022</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://192.168.0.151:4444/</homePageUrl>
<statusPageUrl>http://192.168.0.151:4444/info</statusPageUrl>
<healthCheckUrl>http://192.168.0.151:4444/health</healthCheckUrl>
<vipAddress>SERVICE-C1</vipAddress>
<secureVipAddress>SERVICE-C1</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1572015039634</lastUpdatedTimestamp>
<lastDirtyTimestamp>1572015038932</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
</applications>
查看服务状态
curl http://224:224@localhost:8888/eureka/apps/SERVICE-C1
<application>
<name>SERVICE-C1</name>
<instance>
<instanceId>192.168.0.151:SERVICE-C1:4444</instanceId>
<hostName>192.168.0.151</hostName>
<app>SERVICE-C1</app>
<ipAddr>192.168.0.151</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">4444</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1572015039634</registrationTimestamp>
<lastRenewalTimestamp>1572015669623</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1572015039022</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://192.168.0.151:4444/</homePageUrl>
<statusPageUrl>http://192.168.0.151:4444/info</statusPageUrl>
<healthCheckUrl>http://192.168.0.151:4444/health</healthCheckUrl>
<vipAddress>SERVICE-C1</vipAddress>
<secureVipAddress>SERVICE-C1</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1572015039634</lastUpdatedTimestamp>
<lastDirtyTimestamp>1572015038932</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
关闭服务(如果是up状态,该设置无效)
curl -X PUT “http://224:224@localhost:8888/eureka/apps/SERVICE-C1/192.168.0.151:SERVICE-C1:4444/stauts?value=OUT_OF_SERVICE”
删除服务
curl -X DELETE http://224:224@localhost:8888/eureka/apps/SERVICE-C1/192.168.0.151:SERVICE-C1:4444
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lxrIKAOe-1572017171269)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\1572015983584.png)]
再次查看注册中心,服务的确被删除了。过了一会儿,因为心跳的机制的存在,服务会自动注册上。
新增服务
curl -X PUT “http://224:224@localhost:8888/eureka/apps/SERVICE-C1/192.168.0.151:SERVICE-C1:4444/stauts?value=UP”
对于一个位置的instanceid,服务将不会出现在列表里。