Git Product home page Git Product logo

go-hashicorp-raft-http's Introduction

go-hashicorp-raft-http

A reference implementation by using the Hashicorp Raft lib.

build

go build -o bin/go-hashicorp-raft-http cmd/*

up and running

bin/go-hashicorp-raft-http -id matching1 -raftDir ./snapshots/matching1 -raftAddr :7777  -httpAddr :8887
bin/go-hashicorp-raft-http -id matching2 -raftDir ./snapshots/matching2 -raftAddr :7778  -httpAddr :8888 -joinHttpAddr :8887
bin/go-hashicorp-raft-http -id matching3 -raftDir ./snapshots/matching3 -raftAddr :7779  -httpAddr :8889 -joinHttpAddr :8887

testing

set

curl -XPOST localhost:8887/key -d '{"x": "3"}'
curl -XPOST localhost:8887/key -d '{"y": "1"}'
curl -XPOST localhost:8887/key -d '{"y": "9"}'
curl -XPOST localhost:8887/key -d '{"x": "2"}'
curl -XPOST localhost:8887/key -d '{"x": "0"}'
curl -XPOST localhost:8887/key -d '{"y": "7"}'
curl -XPOST localhost:8887/key -d '{"x": "5"}'
curl -XPOST localhost:8887/key -d '{"x": "4"}'
curl -XPOST localhost:8887/key -d '{"z": "1"}'
curl -XPOST localhost:8887/key -d '{"z": "2"}'

curl -XPOST localhost:8887/key -d '{"z": "3"}'
curl -XPOST localhost:8887/key -d '{"z": "4"}'
curl -XPOST localhost:8887/key -d '{"z": "5"}'
curl -XPOST localhost:8887/key -d '{"z": "6"}'
curl -XPOST localhost:8887/key -d '{"z": "7"}'
curl -XPOST localhost:8887/key -d '{"z": "8"}'
curl -XPOST localhost:8887/key -d '{"z": "9"}'
curl -XPOST localhost:8887/key -d '{"z": "10"}'
curl -XPOST localhost:8887/key -d '{"z": "11"}'
curl -XPOST localhost:8887/key -d '{"z": "12"}'

curl -XPOST localhost:8887/key -d '{"z": "13"}'
curl -XPOST localhost:8887/key -d '{"z": "14"}'
curl -XPOST localhost:8887/key -d '{"z": "15"}'

get

curl -XGET localhost:8887/key/x

leave

curl -XPOST localhost:8887/leave -d '{"id": "matching2","addr":":7778"}'

raft State

curl -XGET localhost:8887/raftstate

snapshot

curl -XGET localhost:8887/snapshot

test snapshot when kill process

ps aux | grep go-hashicorp-raft-http
kill 58443

Todo

  • etcd
  • zookeeper

Reference

go-hashicorp-raft-http's People

Contributors

makersu avatar

Stargazers

 avatar

Watchers

 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.