Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Service discovery in a microservice architecture using consul

24,959 views

Published on

Presentation I gave at Nextbuild 2016. Gives an overview of how Consul can be used in microservice architecture. Accompanying examples and demo can be found here: https://github.com/josdirksen/next-build-consul

Published in: Technology
  • Hello! I do no use writing service very often, only when I really have problems. But this one, I like best of all. The team of writers operates very quickly. It's called ⇒ www.HelpWriting.net ⇐ Hope this helps!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi there! I just wanted to share a list of sites that helped me a lot during my studies: .................................................................................................................................... www.EssayWrite.best - Write an essay .................................................................................................................................... www.LitReview.xyz - Summary of books .................................................................................................................................... www.Coursework.best - Online coursework .................................................................................................................................... www.Dissertations.me - proquest dissertations .................................................................................................................................... www.ReMovie.club - Movies reviews .................................................................................................................................... www.WebSlides.vip - Best powerpoint presentations .................................................................................................................................... www.WritePaper.info - Write a research paper .................................................................................................................................... www.EddyHelp.com - Homework help online .................................................................................................................................... www.MyResumeHelp.net - Professional resume writing service .................................................................................................................................. www.HelpWriting.net - Help with writing any papers ......................................................................................................................................... Save so as not to lose
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • ..............ACCESS that WEBSITE Over for All Ebooks ................ ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Service discovery in a microservice architecture using consul

  1. 1. Service Discovery in a  Architecture using  Microservice Consul
  2. 2. Who Am I Currently doing Devops, Scala stu At Equeris, lean startup within Equens Docker, Consul, Scala, Cloud and other buzzwords. Email me at: I write at: Twitter: jos.dirksen@gmail.com http://www.smartjava.org @josdirksen
  3. 3. Follow along Sources, presentation etc: Demo heavy session https://github.com/josdirksen/next-build-consul
  4. 4. Microservices?
  5. 5. What are microservices? Small, ne-grained easy to replace components. Organized around capabilities. Di erent languages and backends (whatever ts best). Fault tolerant, resiliant, automated deployements. "Small Autonomous services that work together", Sam Newman
  6. 6. From three tier to Microservices
  7. 7. Running Microservices is hard Where is my other service or database? Am I healthy, is the other one healthy? Where do I store con guration? How do I handle redundancy and failover? ... , says everyone"Distributed systems are hard"
  8. 8. Service Discovery
  9. 9. Basic approach Hardcoded IP Address or LookupDNS Lookup is nice! Requires managing names (con g les), DNS Server How to handle failover? DNS
  10. 10. Now with failover Point to a loadbalancerDNS Works nicely with ! How to check health and register services? Programmatic access to LB? DNS
  11. 11. What would be nice Does : Lightweight ( , REST) support failover Has exible and manages Lookups DNS Health checking Con guration
  12. 12. Consul "Consul [..] provides an opinionated framework for service discovery and eliminates the guess-work and development e ort. Clients simply register services and then perform discovery using a DNS or HTTP interface. Other systems require a home- rolled solution." - consul.io
  13. 13. Main Features Service discovery through REST and DNS Simple registration using REST API Distributed KV store for con guration Provides extensive health checking All in one package
  14. 14. Good to know Multi DC-ready API for distributed locks Easy HA Setup Event system Consul = Zookeeper + Nagios + DNSMasq + Scriptings + ...
  15. 15. Consul Architecture
  16. 16. Service Registration Flow 1. Servicecalls Consul Agentwith registration message: . 2. Agentcommunicates registration with Consul Server 3. Agentchecks health of Service. 4. If check succeeds mark as Healthy, if not mark as Unhealthy, communicate results with Server 5. When a lookup for Serviceoccurs, only return Healthyservices http://agent_host/v1/agent/service/register
  17. 17. Sample: registration message { "Name": "service1", "address": "10.0.0.12", "port": 8080, "Check": { "http": "http://10.0.0.12:8080/health", "interval": "5s" } } Send when a new service starts up Check types: script, http, tcp, TTL, Docker
  18. 18. Sample: DNS Lookup $dig @nb-consul.local backend-service.service.consul ; <<>> DiG 9.8.3-P1 <<>> @nb-consul.local backend-service.service.consul ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27716 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;backend-service.service.consul. IN A ;; ANSWER SECTION: backend-service.service.consul. 0 IN A 10.0.9.3 backend-service.service.consul. 0 IN A 10.0.9.2 backend-service.service.consul. 0 IN A 10.0.9.4 Consul provides a DNS Server Works great with Docker ( : will show in Demo)teaser
  19. 19. Sample: REST Lookup $ curl -s http://192.168.99.106:8500/v1/catalog/service/backend-service [{ "Node": "cf2f293e423c", "Address": "192.168.99.111", "ServiceID": "backend-service", "ServiceName": "backend-service", "ServiceAddress": "10.0.9.2", "ServicePort": 8080 },{ "Node": "072b4ea1abc1", "Address": "192.168.99.112", "ServiceID": "backend-service", "ServiceName": "backend-service", "ServiceAddress": "10.0.9.3", "ServicePort": 8080 }]
  20. 20. DEMO
  21. 21. Closer look: DNS Lookup In code: resp, err := http.Get("http://backend-service:8081/") if err != nil { fmt.Println(err) } else { defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) w.Header().Set("Content-Type",resp.Header.Get("Content-Type")) w.Write(body) } For docker: dns: 192.168.99.106 dns_search: service.consul
  22. 22. Consul Ecosystem
  23. 23. Consul template Render template based on Consul state Setup reverse proxy: Nginx, Apache, haproxy global daemon maxconn {{key "service/haproxy/maxconn"}} defaults mode {{key "service/haproxy/mode"}}{{range ls "service/haproxy/timeouts"}} timeout {{.Key}} {{.Value}}{{end}} listen http-in bind *:8000{{range service "release.web"}} server {{.Node}} {{.Address}}:{{.Port}}{{end}}
  24. 24. Demo
  25. 25. Envconsul "III. Con g Store con g in the environment", http://12factor.net/ More settings >More complexity $ envconsul -consul demo.consul.io -prefix redis/config redis-server [opts...] Vault: help in managing secrets
  26. 26. DEMO ENVCONSUL
  27. 27. Prometheus & Grafana
  28. 28. More information links: This presentation, sources and docker stu : https://www.consul.io/ https://github.com/hashicorp/consul-template https://github.com/hashicorp/envconsul https://github.com/josdirksen/next-build-consul
  29. 29. Thank You!

×