GithubHelp home page GithubHelp logo

dolly's Introduction

Dolly

ZMQ centralized key/value clone model with PUB/SUB

This simple network of peers replicates a key/value store using PUB/SUB ZMQ sockets. A client can make a GET request to any replica and receive that replica's current value of the key. Consistency is maintained by serializing all PUT requests through the leader -- which is selected as the replica with the lowest PID value. If the leader goes down, GET requests can still be made, but all PUTs are dropped until the leader comes back online.

Getting Started

To run the code, first get and install the package:

$ go get github.com/bbengfort/dolly

Note that this will require the installation of ZMQ, which can be tricky depending on your environment. Then create a peers.json file to define the replica network:

[
  {
    "pid": 1,
    "name": "alpha",
    "address": "localhost",
    "host": "apollo",
    "ipaddr": "127.0.0.1",
    "updates": 3264,
    "snapshots": 3265,
    "requests": 3266
  },
  {
    "pid": 2,
    "name": "bravo",
    "address": "localhost",
    "host": "apollo",
    "ipaddr": "127.0.0.1",
    "updates": 3267,
    "snapshots": 3268,
    "requests": 3269
  },
  {
    "pid": 3,
    "name": "charlie",
    "address": "localhost",
    "host": "apollo",
    "ipaddr": "127.0.0.1",
    "updates": 3270,
    "snapshots": 3271,
    "requests": 3272
  }
]

Note that each replica requires three ports to bind or connect sockets on.

  • updates: the port where the leader binds PUB and replicas connect SUB to get key/value updates.
  • snapshots: the port where the leader binds ROUTER and replicas connect DEALER so that a late replica can catch up with the leader.
  • requests: the port where the leader binds PULL and replicas and clients bind PUSH so that the leader can have its state updated.

dolly's People

Contributors

bbengfort avatar

Stargazers

BlancosWay avatar

Watchers

 avatar James Cloos avatar  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.