Eureka Server内部通过JAX-RS(Java API for RESTful Web Services)规范提供了一系列的管理服务节点的请求节点,这样也保证了在非JVM环境运行的程序可以通过HTTP REST方式进行管理维护指定服务节点,所以只要遵循Eureka协议的服务节点都可以进行注册到Eureka Server。
<?xml version="1.0" encoding="UTF-8"?> <xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"elementFormDefault="qualified"attributeFormDefault="unqualified"> <xsd:elementname="instance"> <xsd:complexType> <xsd:all> <!-- hostName in ec2 should be the public dns name, within ec2 public dns name will always resolve to its private IP --> <xsd:elementname="hostName"type="xsd:string" /> <xsd:elementname="app"type="xsd:string" /> <xsd:elementname="ipAddr"type="xsd:string" /> <xsd:elementname="vipAddress"type="xsd:string" /> <xsd:elementname="secureVipAddress"type="xsd:string" /> <xsd:elementname="status"type="statusType" /> <xsd:elementname="port"type="xsd:positiveInteger"minOccurs="0" /> <xsd:elementname="securePort"type="xsd:positiveInteger" /> <xsd:elementname="homePageUrl"type="xsd:string" /> <xsd:elementname="statusPageUrl"type="xsd:string" /> <xsd:elementname="healthCheckUrl"type="xsd:string" /> <xsd:elementref="dataCenterInfo"minOccurs="1"maxOccurs="1" /> <!-- optional --> <xsd:elementref="leaseInfo"minOccurs="0"/> <!-- optional app specific metadata --> <xsd:elementname="metadata"type="appMetadataType"minOccurs="0" /> </xsd:all> </xsd:complexType> </xsd:element>
<xsd:elementname="dataCenterInfo"> <xsd:complexType> <xsd:all> <xsd:elementname="name"type="dcNameType" /> <!-- metadata is only required if name is Amazon --> <xsd:elementname="metadata"type="amazonMetdataType"minOccurs="0"/> </xsd:all> </xsd:complexType> </xsd:element>
<xsd:elementname="leaseInfo"> <xsd:complexType> <xsd:all> <!-- (optional) if you want to change the length of lease - default if 90 secs --> <xsd:elementname="evictionDurationInSecs"minOccurs="0"type="xsd:positiveInteger"/> </xsd:all> </xsd:complexType> </xsd:element>
<xsd:simpleTypename="dcNameType"> <!-- Restricting the values to a set of value using 'enumeration' --> <xsd:restrictionbase = "xsd:string"> <xsd:enumerationvalue = "MyOwn"/> <xsd:enumerationvalue = "Amazon"/> </xsd:restriction> </xsd:simpleType>
<xsd:simpleTypename="statusType"> <!-- Restricting the values to a set of value using 'enumeration' --> <xsd:restrictionbase = "xsd:string"> <xsd:enumerationvalue = "UP"/> <xsd:enumerationvalue = "DOWN"/> <xsd:enumerationvalue = "STARTING"/> <xsd:enumerationvalue = "OUT_OF_SERVICE"/> <xsd:enumerationvalue = "UNKNOWN"/> </xsd:restriction> </xsd:simpleType>
<xsd:complexTypename="appMetadataType"> <xsd:sequence> <!-- this is optional application specific name, value metadata --> <xsd:anyminOccurs="0"maxOccurs="unbounded"processContents="skip"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
curl -v -X PUT http://localhost:10000/eureka/apps/HENGBOY-SPRING-CLOUD-EUREKA-PROVIDER/hengboy-spring-cloud-eureka-provider:20000:v1.0/status\?value\=DOWN