-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Eureka 2.0 Server Configuration And Use
- JDK 1.7
Eureka 2.0 uses two main types of servers by default, write servers and read servers. An optional bridge module is available that can be configured to be a component of a write server that allows bridge of data from a currently deployed eureka 1.0 system to the 2.0 system.
The combination of resolverType and serverList defines the write server cluster.
- ResolverType can either be fixed (read straight from the serverList) or dns (the serverList name is taken as a dns entry and expanded);
- ServerList is a comma delimited list with each entry in the format name:registrationPort:interestPort:replicationPort.
eureka.common.writeCluster.resolverType=fixed
eureka.common.writeCluster.serverList=["localhost:12102:12103:12104","localhost:12112:12113:12114"]
This common config to identify all write servers is needed by all server types.
Each server will also need configuration to self identify.
- appName - the server's appName in its own InstanceInfo record
- vipAddress - the server's vipAddress in its own InstanceInfo record
- dataCenterInfo.type - Basic or AWS
eureka.instanceInfo.appName=eureka-write-cluster
eureka.instanceInfo.vipAddress=eureka-write-cluster
eureka.dataCenterInfo.type=Basic
Write servers have the following responsibilities:
- accepting registration requests from eureka registration clients
- accepting interest discover requests from eureka interest clients and server ChangeNotifications
- replicate local registration data to peer write servers
git clone https://github.com/Netflix/eureka.git
cd eureka/
git checkout 2.x
cd eureka2-write-server/
../gradlew run
For each of the responsibilities listed above, a separate port needs to be exposed. These are governed by the properties
- eureka.services.registration.port
- eureka.services.discovery.port
- eureka.services.replication.port
Change the ports specified in the configuration file if you need the ports to be different from the defaults for each specific write server.
Write servers have the following responsibility:
- accepting interest discover requests from eureka interest clients and server ChangeNotifications
git clone https://github.com/Netflix/eureka.git
cd eureka/
git checkout 2.x
cd eureka2-read-server/
../gradlew run
The interest protocol port is governed by the property:
- eureka.services.discovery.port
Change the port specified in the configuration file if you need the port to be different from the defaults for each specific read server.
Adding eureka2-testkit as a gradle dependency:
dependencies {
compile "com.netflix.eureka:eureka2-testkit:2.0.0-rc.2"
}
Adding eureka2-testkit as a maven dependency:
<dependency>
<groupId>com.netflix.eureka</groupId>
<artifactId>eureka2-testkit</artifactId>
<version>2.0.0-rc.2</version>
<scope>test</scope>
</dependency>
To run Eureka Servers (of both variants) in tests, a junit rule exist that allows deployment of arbitrary numbers of write and read servers.
An example of how this rule is used can be see in this integration test, where 3 write servers and 6 read servers are created and various clients connecting to these write and read clusters are used.
- Eureka at a glance
- Configuring Eureka
- Building Eureka Client and Server
- Running the Demo Application
- Deploying-Eureka-Servers-in-EC2
- Understanding Eureka Client/Server Communication
- Server Self Preservation Mode
- Eureka REST operations
- Understanding Eureka Peer to Peer communication
- Overriding Default Configurations
- FAQ