Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 1.22 KB

README.md

File metadata and controls

63 lines (42 loc) · 1.22 KB

gog

Gossip Over Gophers

![GoDoc] (https://godoc.org/github.com/go-distributed/gog?status.png)

[Writeup] (https://drive.google.com/file/d/0BzkE2qUvDHtpTFdZRVFCWDI0dWM/view?usp=sharing)

###How to build:

$ go build

Show usage:

$ ./gog -h

Run a standalone node:

$ ./gog

To join an existing cluster:

  1. Form a two-node-cluster

    $ ./gog -addr="localhost:8000" -rest-addr="localhost:8001"
    $ ./gog -addr="localhost:8002" -rest-addr="localhost:8003"
  2. Let the first node join the second node

    $ curl http://localhost:8001/api/join -d peer=localhost:8002
  3. Show the view in the first node

    $ curl http://localhost:8001/api/list
    {"active_view":[{"id":"localhost:8002","address":"localhost:8002"}],"passive_view":[]}

You can also provide a json file contains a list of nodes:

$ cat peers.json
["localhost:8000", "localhost:8001", "localhost:8002", "localhost:8003"]

$ curl -d @peers.json -H "Content-Type: application/json" http://localhost:8001/api/join

To broadcast a message:

$ curl http://localhost:8001/api/broadcast -d message=hello