This is part 2 of Developing Instagram Clone series, other parts are linked below
To avoid this we need a place where services can register itself and assign it a name, this place is “service discovery”, You can think of service discovery as DNS, it maps service IP and port to a name.
We will be using Spring Cloud Netflix Eureka, the reason I will not go deep into this is that we are planning to deploy our Instagram clone to K8s, and we don’t need a service discovery since we will be using K8s services.
Clone the Insta-discovery from GitHub, All you need to do is to enable eureka server
@SpringBootApplication
@EnableEurekaServer
public class InstaDiscoveryApplication {
public static void main(String[] args) {
SpringApplication.run(InstaDiscoveryApplication.class, args);
}
}
Disable self-registration
spring:
application:
name: insta-discovery
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: false
Now you have Eureka server running on
http://localhost:8761
#microservices #cloud #developer