eurkea在线关闭服务

客户端服务实例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,服务将不会出现在列表里。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值