-
Notifications
You must be signed in to change notification settings - Fork 1
Micro service location services documentation
Eureka is a service used for discovering service implementations which are then used for load balancing and fail-over. It is made up of 2 key components, a client and a core server implementation. The server implementation uses the client to manage the connections to other instances of the eureka service. There are many differences between the networking configuration of SoftLayer and the Amazon EC2 cloud, and we aimed to exploit the strengths of the SoftLayer network infrastructure.
During startup of the eureka server in the EC2 infrastructure, the available Elastic IP addresses (EIP) are discovered using the Amazon API, and compared to registered eureka services to discover which EIPs have yet to be bound.
Today SoftLayer only supports programatically updating a 'GlobalIP' address (one that is routed between datacentres). This was insufficient for our needs, as it can introduce an extra point of failure. We therefore elected to use a 'portable subnet'. This is a defined IP block, which can be used by multiple servers on a VLAN.
We defined a portable subnet, for a VLAN in each datacentre. Then for each server instance we create a network script to register the server with an IP address allocated from the portable subnet.
- more ifcfg-eth0-range1
- IPADDR_START=10.80.194.122
- IPADDR_END=10.80.194.122
- CLONENUM_START=1
- NETMASK=255.255.255.248
- GATEWAY=10.80.194.121
This gives us an eureka server running at a well known IP address, which can then be found through DNS.
We created a DNS entry for each eureka server portable subnet IP address, with the convention eureka-dddd-v-i where dddd is the datacentre, v is the VLAN, and i is an instance within the VLAN.
We then created a DNS entry for each datacentre. Neither of the two DNS providers we had access to, allowed configuration of a DNS entry with multiple TXT entries. We instead used a space delimited list, which meant the Java DNS context resolver enclosed the string in double quotes. This required a change to DiscoveryClient to remove double quotes from the string. As double quotes and spaces can not be part of a URL, the change is a safe change to pull into the base Netflix implementation, if necessary.
We finally created a DNS entry for a region, which listed the datacentre within that region.
Instances within the SoftLayer cloud can have two network interfaces. One is privately accessible by machines within the same VLAN and other VLANs associated with the account. The other is a publicly accessible one. Also the hostname and domain associated to an instance at creation are only resolvable within that instance. A eureka client, tries to register it's hostname as the target for a service therefore doesn't work within SoftLayer.
We therefore implemented a change to AbstractInstanceInfo and PeerAwareInstanceRegistry to always use the IP address of the eth0 interface. (this should probably be made adjustable). Also to compare the ip addresses as well as hostnames when detecting if an instance is a local instance.
Eureka only recognises three types of datacentres, and has special behaviour defined for the Amazon type. It is not necessary yet, to introduce a 4th type but any future enhancements for integration with SoftLayer will probably require it. We don't believe this is a major change.