Git Product home page Git Product logo

grape's Introduction

Grape

Build Status Go Report Card Hex.pm

Introduction

Grape is a decentralized distribution memory caching system, using consistent hashing to decide which node to store the data in. Grape support redis SET and GET command, it's easy to use the redis-cli to add or remove a node from cluster. Because the grape like a architecture of peer-to-peer systems, you can use redis client to connect any of a node of cluster, and the connecting node will send request to destination node.

Installation

go get -v github.com/leviathan1995/grape/

Getting Started

Creating and using a cluster

First start a double-member cluster, each node set the peer-server as RemotePeers in config file

./grape -c tests/node1.yaml
./grape -c tests/node2.yaml

Next, connect to any of a node and store a key-value and retrieve the stored key

./redis-cli -p 9221
127.0.0.1:9221> SET key value
OK
127.0.0.1:9221> GET key
"value"

Adding a new node

if you want to add a node3 to the exist cluster, need to configurate any of a node in cluster to RemotePeers in config file

./grape -c test/node3.yaml

and it will be automatically join the cluster

Removing a node

Connect any of a node in cluster, use REMOVE IP PORT

./redis-cli -p 9221
127.0.0.1:9221> REMOVE 127.0.0.1 9001
OK

TODO

  • TTL
  • LRU algorithm
  • Monitor nodes survival

grape's People

Contributors

leviathan1995 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.