Eureka’s core class.

InstanceInfo

< instance > < instanceId > CHEND - PC. Sen5. Sz: sw - user: 8006 < / instanceId > < hostName > 192.168.150.24 < / hostName > < > app sw - user < / app > The < ipAddr > 192.168.150.24 < / ipAddr > < status > UP < / status > < overriddenstatus > UNKNOWN < / overriddenstatus > < port enabled="true">8006</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>1554119366405</registrationTimestamp> <lastRenewalTimestamp>1554164316452</lastRenewalTimestamp> <evictionTimestamp>0</evictionTimestamp> <serviceUpTimestamp>1554119366406</serviceUpTimestamp> </leaseInfo> <metadata> <management.port>8006</management.port> <jmx.port>51543</jmx.port> </metadata> < homePageUrl > http://192.168.150.24:8006/ < / homePageUrl > < statusPageUrl > http://192.168.150.24:8006/actuator/info < / statusPageUrl > < healthCheckUrl > http://192.168.150.24:8006/actuator/health < / healthCheckUrl > < vipAddress > sw - user < / vipAddress > <secureVipAddress>sw-user</secureVipAddress> <isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer> <lastUpdatedTimestamp>1554119366406</lastUpdatedTimestamp> <lastDirtyTimestamp>1554119366397</lastDirtyTimestamp> <actionType>ADDED</actionType> </instance>Copy the code

Field meaning

  • InstanceId: instance id
  • HostName: indicates the hostName
  • App: indicates the name of the application
  • IpAddr: IP address
  • Status: indicates the status of the instance, for example, UP,DOWN,STARTING,OUT_OF_SERVICE,UNKNOWN
  • Overriddenstatus: specifies the status of the external secondary high. The default value is UNKNOWN
  • Port: indicates the port number
  • SecurePort: HTTPS port number
  • CountryId: countryId (deprecated)
  • DataCenterInfo: Data center information, Netflix or Amazon or MyOwn
  • leaseInfo
    • The interval to renew their renewalIntervalInSecs: the client side
    • DurationInSecs: specifies the validity period of the lease to be specified in the client segment
    • RegistrationTimestamp: the first registration time of the lease set by the server
    • LastRenewalTimestamp: indicates the last renewal time of the lease set by the server
    • EvictionTimestamp: time set by the server when the lease is deleted
    • ServiceUpTimestamp: the server end set of instances of the service mark for the UP
  • HomePageUrl: indicates the homePageUrl of the application instance
  • StatusPageUrl: indicates the statusPageUrl of the application instance
  • HealthCheckUrl: indicates the URL of the application instance health check
  • SecureVipAddress: indicates the VIRTUAL IP address of HTTPS
  • IsCoordinatingDiscoveryServer: first, mark the discoveryServer instance is a response to your request
  • LastUpdatedTimestamp: time when the status information was last updated
  • LastDirtyTimestamp: Latest State-Owned enterprise time of instance information. It is used to indicate whether the instance information is consistent with Eureka Server on the client side and to synchronize information between multiple Eureka servers on the Server side
  • ActionType: Actions performed by the Eureka Server on the instance, including ADDED, MODIFIED, and DELETED

ServiceInstance

ServiceInstance is SpringCloud’s abstract interface to the instance information of Service Discovery. It specifies the common information of service discovery instance application. Since SpringCloud ADAPTS to Zookeeper,Consul,Netflix Eureka registries, it needs to be more abstract. EurekaRegistration is an implementation class of the ServiceInstance interface.

public interface ServiceInstance { default String getInstanceId() { return null; } String getServiceId(); String getHost(); int getPort(); boolean isSecure(); URI getUri(); Map<String, String> getMetadata(); default String getScheme() { return null; }}Copy the code

InstanceStatus

InstanceStatus indicates the status of a service instance

public static enum InstanceStatus {
    UP,
    DOWN,
    STARTING,
    OUT_OF_SERVICE,
    UNKNOWN;

    private InstanceStatus() {
    }

    public static InstanceInfo.InstanceStatus toEnum(String s) {
        if (s != null) {
            try {
                return valueOf(s.toUpperCase());
            } catch (IllegalArgumentException var2) {
                InstanceInfo.logger.debug("illegal argument supplied to InstanceStatus.valueOf: {}, defaulting to {}", s, UNKNOWN);
            }
        }

        return UNKNOWN;
    }
}
Copy the code

This class includes UP,DOWN,STARTING, OUT_OF_SERVICE, and UNKNOWN states. OUT_OF_SERVICE stops receiving requests. Instances in the service state are not routed to.

LeaseManager

The interface defines several basic operations of an application service instance in the service center

Public interface LeaseManager<T> {// Used to register service instance information void register(T var1, int VAR2, Boolean VAR3); Boolean cancel(String var1, String VAR2, Boolean VAR3); Boolean renew(String VAR1, String VAR2, Boolean VAR3); // Renew (String VAR1, String VAR2, Boolean VAR3); Void evict(); void evict(); void evict(); }Copy the code

LookupService

This interface defines the query method for Eureka Client to obtain service instances from the service center. This interface is mainly used by the Client side, which defines the method of obtaining all application information, obtaining all service instances according to the application ID, and obtaining the next service instance in round-robin mode according to visualHostname.

public interface LookupService<T> {
    Application getApplication(String var1);

    Applications getApplications();

    List<InstanceInfo> getInstancesById(String var1);

    InstanceInfo getNextServerFromEureka(String var1, boolean var2);
}
Copy the code