GithubHelp home page GithubHelp logo

global19-atlassian-net / finagle-consul Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ncbi/finagle-consul

0.0 1.0 0.0 126 KB

Service discovery for Finagle cluster with Consul.

License: Other

finagle-consul's Introduction

Finagle Consul

Service discovery for Finagle cluster with Consul. This project was originally developed by kachayev/finagle-consul, dmexe/finagle-consul and matteobanerjee/finagle-consul

About

Consul is a distributed, highly available and extremely scalable tool for service discovery and configuration.

This project provides two resolution/announcement strategies: one using Consul sessions and K/V, the other using Consul's native service registration mechanism (referred to as the "catalog" strategy here).

Catalog strategy

Usage:

Announce (the announcer requires an agent, usually running on localhost):

consul!localhost:8500!/serviceName

Resolve (doesn't require an agent):

consul!host1:port1,host2:port2,...!/serviceName

For Example:

val server = Http.serveAndAnnounce("consul!127.0.0.1:8500!/RandomNumber")
val client = Http.newService("consul!127.0.0.1:8500!/RandomNumber")

Pros:

  • Integrates cleanly with native Consul Services

Cons:

  • Requires a Consul Agent for server announcements
  • Requires clean up of dead services in environments where server addresses are ephemeral, like Mesos

The catalog strategy uses Consul's built-in service discovery APIs. The main advantage of this is that it makes it easy to run Finagle services alongside non-finagle services. You can, for example, discover a Rails web service and MySQL database using this resolver.

The main downside is on the announcement side: The consul catalog does not support ephemeral nodes, so services will not be deregistered in case of an unclean shutdown, e.g. OOM errors or kill -9. They will instead only fail their health check and be put in a critical state. Though the resolver will filter these out, the Consul catalog will get polluted with dead nodes and will require clean up if running in an environment like Mesos. This is an issue with Consul itself that can be mitigated with a cron job.

Example

Server

val server = Http.server.serveAndAnnounce("consul!localhost:8500!/EchoServer?ttl=100", s":$serverPort", service)

// Ensure clean de-registration
sys.addShutdownHook {
  Await.result(server.close())
}
Await.ready(server)

Client

val client = Http.client.newService("consul!localhost:8500!/EchoServer")

D-Tab

Dentry.read("/account=>/$/gov.nih.nlm.ncbi.finagle.serverset/consul/consul.service.aws-prod.consul:80/account-version-2-2-build-73")))

finagle-consul's People

Contributors

ashald avatar dmexe avatar kachayev avatar klortho avatar kmt avatar matteosb avatar vadim-miller2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.