160 likes | 266 Views
Service Discovery. Presented By: Abhishek Anand Amralkar. Who Am I?. Currently DevOps Engineer at Talentica and Clojure beginner * I write at www.abhishekamralkar.com * My Github: http://github.com/abhishekamralkar * Twitter Handle: aamralkar. Service Discovery?.
E N D
Service Discovery Presented By: Abhishek Anand Amralkar
Who Am I? Currently DevOps Engineer at Talentica and Clojure beginner * I write at www.abhishekamralkar.com * My Github: http://github.com/abhishekamralkar * Twitter Handle: aamralkar Presenter Name
Service Discovery? 0. How to know which service running? 1. On which port it is running? 2. How Application will connect to services • Which IP address? • Which Port? Presenter Name
Traditional Method 0 . Hardcoded Paths/address/ports in Application configuration. 1 . Use of hostnames in `/etc/hosts` or may be DNS server. Worked well before the Micro service Architecture Era. Abhishek Anand Amralkar
Solution? 0. Consul 1. SkyDNS 2. Zookeeper 3. ETCD Presenter Name
What is Consul? 0. Service Discovery • DNS • HTTP (JSON) • Health Checking • Key/Value Store • Multi Datacenter Aware • Service Registration Presenter Name
Install Consul 0. Single binary can run as server as well as agent. • Consul can run on individual machine • Consul is recommended to run in Cluster moder (N+1). • Consul servers are responsible for running the cluster in Consensus protocol and store client state. • Consul agents are stateless. • Consul works on Consensus protocol. Presenter Name
Consensus Protocol 0. To provide consistency as defined in CAP theorem • Based on RAFT protocol .. http://thesecretlivesofdata.com/raft/ • Raft nodes are always in one of three states: follower, candidate, or leader. • All nodes initially start out as a follower. In this state, nodes can accept log entries from a leader and cast votes. I • f no entries are received for some time, nodes self-promote to the candidate state. • In the candidate state, nodes request votes from their peers. If a candidate receives a quorum of votes, then it is promoted to a leader. • The leader must accept new log entries and replicate to all the other followers. Presenter Name
RESTful HTTP API • The API can be used to perform CRUD operations on nodes, services, checks, configuration, and more. The endpoints are versioned to enable changes without breaking backwards compatibility. • Each endpoint manages a different aspect of Consul: • acl - Access Control Lists • agent - Consul Agent • catalog - Nodes and Services • coordinate - Network Coordinates • event - User Events Presenter Name
RESTful HTTP API • health - Health Checks • kv - Key/Value Store • query - Prepared Queries • session - Sessions • status - Consul System Status Presenter Name