一、Eureka 简介

服务发现技术选型

第二章:微服务与Spring Cloud  Eureka 上篇

二、Spring Cloud  Eureka 入门案例

1、在浏览器输入:http://localhost:8761/

第二章:微服务与Spring Cloud  Eureka 上篇

2、在浏览器输入:http://localhost:8761/eureka/apps

<applications><versions__delta>1</versions__delta><apps__hashcode>UP_1_</apps__hashcode><application><name>DEMO-CLIENT1</name><instance><instanceId>LAH:demo-client1:8081</instanceId><hostName>LAH</hostName><app>DEMO-CLIENT1</app><ipAddr>192.168.118.30</ipAddr><status>UP</status><overriddenstatus>UNKNOWN</overriddenstatus><port enabled="true">8081</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>1541662811411</registrationTimestamp><lastRenewalTimestamp>1541662961393</lastRenewalTimestamp><evictionTimestamp>0</evictionTimestamp><serviceUpTimestamp>1541660845280</serviceUpTimestamp></leaseInfo><metadata><management.port>8081</management.port><jmx.port>55850</jmx.port></metadata><homePageUrl>http://LAH:8081/</homePageUrl><statusPageUrl>http://LAH:8081/actuator/info</statusPageUrl><healthCheckUrl>http://LAH:8081/actuator/health</healthCheckUrl><vipAddress>demo-client1</vipAddress><secureVipAddress>demo-client1</secureVipAddress><isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer><lastUpdatedTimestamp>1541662811412</lastUpdatedTimestamp><lastDirtyTimestamp>1541662811343</lastDirtyTimestamp><actionType>ADDED</actionType></instance></application></applications>

三、 REST API实例

1、查询所有应用示例

1、命令

curl -i 192.168.118.30:8761/eureka/apps

2、输出

 1 HTTP/1.1 200
 2 Content-Type: application/xml
 3 Transfer-Encoding: chunked
 4 Date: Thu, 08 Nov 2018 08:40:36 GMT
 5 
 6 <applications>
 7   <versions__delta>1</versions__delta>
 8   <apps__hashcode>UP_1_</apps__hashcode>
 9   <application>
10     <name>DEMO-CLIENT1</name>
11     <instance>
12       <instanceId>LAH:demo-client1:8081</instanceId>
13       <hostName>LAH</hostName>
14       <app>DEMO-CLIENT1</app>
15       <ipAddr>192.168.118.30</ipAddr>
16       <status>UP</status>
17       <overriddenstatus>UNKNOWN</overriddenstatus>
18       <port enabled="true">8081</port>
19       <securePort enabled="false">443</securePort>
20       <countryId>1</countryId>
21       <dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
22         <name>MyOwn</name>
23       </dataCenterInfo>
24       <leaseInfo>
25         <renewalIntervalInSecs>30</renewalIntervalInSecs>
26         <durationInSecs>90</durationInSecs>
27         <registrationTimestamp>1541662811411</registrationTimestamp>
28         <lastRenewalTimestamp>1541666502900</lastRenewalTimestamp>
29         <evictionTimestamp>0</evictionTimestamp>
30         <serviceUpTimestamp>1541660845280</serviceUpTimestamp>
31       </leaseInfo>
32       <metadata>
33         <management.port>8081</management.port>
34         <jmx.port>55850</jmx.port>
35       </metadata>
36       <homePageUrl>http://LAH:8081/</homePageUrl>
37       <statusPageUrl>http://LAH:8081/actuator/info</statusPageUrl>
38       <healthCheckUrl>http://LAH:8081/actuator/health</healthCheckUrl>
39       <vipAddress>demo-client1</vipAddress>
40       <secureVipAddress>demo-client1</secureVipAddress>
41       <isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
42       <lastUpdatedTimestamp>1541662811412</lastUpdatedTimestamp>
43       <lastDirtyTimestamp>1541662811343</lastDirtyTimestamp>
44       <actionType>ADDED</actionType>
45     </instance>
46   </application>
查询所有应用示例

相关文章:

  • 2021-10-03
  • 2021-04-14
  • 2021-08-28
  • 2021-10-20
  • 2022-12-23
  • 2021-09-20
  • 2021-06-16
  • 2022-01-12
猜你喜欢
  • 2021-12-06
  • 2022-01-21
  • 2021-07-19
  • 2021-07-06
  • 2021-10-26
  • 2021-07-02
  • 2021-11-07
相关资源
相似解决方案