Thursday, July 12, 2018

Spring Boot and Netflix: Eureka Server

https://spring.io/blog/2015/01/20/microservice-registration-and-discovery-with-spring-cloud-and-netflix-s-eureka


let's start with an empty Eureka Server:

https://start.spring.io/starter.zip?name=eurekatest&groupId=org.pierre&artifactId=eurekatest&version=1.0&description=mavenfilter&packageName=org.pierre.eurekatest&type=maven-project&packaging=jar&javaVersion=1.8&language=java&bootVersion=2.0.2.RELEASE

run it, and hit:

http://localhost:8761


We have some basic working examples here at https://github.com/netflix-spring-one

first we run the Eureka Server:

git clone https://github.com/netflix-spring-one/sample-eureka
cd sample-eureka
gradle build
java -jar ./build/libs/sample-eureka.jar


then a sample service

git clone https://github.com/netflix-spring-one/sample-recommendations.git
cd sample-recommendations
gradle build
java -jar build/libs/sample-recommendations.jar

download latest gradle from https://gradle.org/releases/, unzip it to E:/apps and make sure /e/apps/gradle-4.8/bin/gradle can be executed (I use gitBash shell)

in build.gradle, change apply plugin: 'spring-boot' into apply plugin: 'org.springframework.boot'

to build, simply run "gradle build"

all the dowloaded jars are in %HOME%\.gradle\caches\modules-2\files-2.1 (the equivalent of %HOME%/.m2/repository )

Recommendations runs at

curl http://localhost:8001/api/recommendations/jschneider

and Eureka Server at http://localhost:9000/











No comments: