Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Cloud config server and Eureka

In Cloud config, we store config which can be accessed by other micro services. In Eureka also we store config info. So what is the difference and when to use what?

like image 943
codingsplash Avatar asked Mar 09 '23 04:03

codingsplash


2 Answers

After learning some more I understood that Eureka is not meant for storing config. It is meant for service registry and discovery. Cloud Config acts as a centralized config mechanism. Eureka on the other hand is meant so that services can discover each other without having to hard code the host and port anywhere.

like image 132
codingsplash Avatar answered Mar 10 '23 17:03

codingsplash


To my knowledge of experiments on spring cloud config server and spring cloud Netflix's Eureka server,I found below things,

  1. Whenever Spring-Cloud-Config-Server is used we should mention git URI and this git URI will be having yml/property files with spring profile and other server port related details.

--- spring: cloud: config: server: git: uri: https://github.com/username/repository-name searchPaths: ConfigData # "native" is used when the native profile is active, for local tests with a classpath repo: native: searchLocations: classpath:offline-repository/ server: port: 8001

If you see yml file I have given uri as git-uri where my other spring-profiles are placed under ConfigData folder and I'm telling in which port server should run i.e., 8001.

Now when you run your cilent application with below yml file configured

--- spring: profiles: active: northamerica application: name: lab-3-client cloud: config: uri: http://localhost:8001 server: port: 8002

all your client properties will be overwritten by server properties.

  1. Whenever Spring-Cloud-eureka-server is used we will not connect to spring-cloud-config-server instead we connect to eureak to discover all clients who will be having profile details

--- spring: profiles: default server: port: 8010
eureka: instance: hostname: eurekahost client: registerWithEureka: false fetchRegistry: false serviceUrl: defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

by using below yml file and @EnableDiscoveryClient cilent wil register to eureka server which you can't be done using sprin-cloud-config-server

--- eureka: client: serviceUrl: defaultZone: http://localhost:8010/eureka/ server: port: ${PORT:${SERVER_PORT:0}} # Select any available port if neither port nor server port are specified.

By looking into all the configurations what I understand is

a) With the Config Server you have a central place to manage external properties for applications across all environments.

b) For registering multiple clients to multiple servers, spring-cloud-eureka is used

like image 32
Praveen Kumar Mekala Avatar answered Mar 10 '23 18:03

Praveen Kumar Mekala