GithubHelp home page GithubHelp logo

akka-zk-cluster-seed's Introduction

akka-zk-cluster-seed

Bootstrap your akka cluster with this one simple trick.

akka-zk-cluster-seed is an akka extension that will free you from having to manage cluster seed nodes.

Assuming you already have easy access to a zookeeper cluster.

use

Add the folowing dependency to your project. akka-zk-cluster-seed is built with akka dependencies marked as provided, so it should work with a reasonable range of akka versions configured in your build.sbt. Note that you must also have `spray 1.3.X and spray-json as dependencies in your project if you want to use the neftlix exhibitor integration described below.

libraryDependencies += "com.sclasen" %% "akka-zk-cluster-seed" % "0.1.2"  // If using Akka 2.3.x
libraryDependencies += "com.sclasen" %% "akka-zk-cluster-seed" % "0.1.8"  // If using Akka 2.4.x

When starting your app, use the ZookeeperClusterSeed extension, instead of the Cluster extension to join your cluster.

val system = ...
ZookeeperClusterSeed(system).join()

configure

akka-zk-cluster-seed uses the standard akka reference.conf configuration defaults mechanism.

You will certainly want to provide an override to the akka.cluster.seed.zookeeper.url config property. It expects standard zookeeper url format like so: 192.168.12.11,192.168.12.12,192.168.12.13:2818

// reference.conf
akka.cluster.seed.zookeeper {
    url = "127.0.0.1:2181"
    path = "/akka/cluster/seed"
}

netfix exhibitor integration: if you want to use netflix exhibitor to discover your zookeeper servers, you should configure like so.

// application.conf
akka.cluster.seed.zookeeper {
    path = "/akka/cluster/seed"
    exhibitor {
        url = "https://user:pass@host:port
        validate-certs = true|false
    }
}

If you require a different exhibitor request path than the default /exhibitor/v1/cluster/list

// application.conf
akka.cluster.seed.zookeeper {
    path = "/akka/cluster/seed"
    exhibitor {
        url = "https://user:pass@host:port
        request-path = "/my/custom/path"
        validate-certs = true|false
    }
}

If your zookeeper path requires authorization you have to specify additional authorization section:

// application.conf
akka.cluster.seed.zookeeper {
    authorization {
        scheme = "digest"
        auth = "username:secret"
    }
}

details

akka-zk-cluster-seed uses netflix curator zookeeper client and recipes to manage a single, dynamic seed node for your cluster. It uses the curator LeaderLatch to elect a node to serve as a seed node. The lead node joins itself to the cluster and all other nodes joinSeedNodes using the current leader as the seed. If the leader goes offline, a new leader is elected to be the seed.

If you need to use other hostname & port you may configure the name of the environment variables to retrieve these values from. This might be handy to use with docker containers

// reference.conf
akka.cluster.seed.zookeeper {
    url = "127.0.0.1:2181"
    path = "/akka/cluster/seed"
    host_env_var = ${?HOST}
    port_env_var = ${?PORT_8080}
}

akka-zk-cluster-seed's People

Contributors

briantopping avatar joescii avatar joprice avatar lgaillard avatar lustefaniak avatar sclasen avatar timcharper avatar twisniewski avatar vkrot avatar zfoxdev 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.