Skip to content

implementation of Chord : a scalable peer-to-peer lookup protocol for internet applications

Notifications You must be signed in to change notification settings

taisho6339/gord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gord

This repository goals a reference implementation of Chord protocol.

What is Gord?

Gord is a peer-to-peer lookup service for internet applications. Gord provides an ability to return which server node a given key belongs to by cooperating with other Gords, which are distributed across other servers. Gord will start as a gRPC server and your application can determine which node should contain your data by simply giving Gord a key via gRPC.

Features

  • Resolve the node which a given key belongs to

How is it work?

Gord is an implementation of DHT Chord. Chord protocol is an algorithm which extends consistent hashing. Gord server, using chord protocol, allocates a key to a node in distributed nodes ring.

chord ring

In addition, the gord servers communicate with each other via gRPC to synchronize route information. Then, the client can query via gRPC to resolve the node.

gRPC server

Usage

Gord's gRPC server listens 26041 port by default.

## Build
make build

## Check how to use this command
./gordctl -h

## Start server
./gordctl -l hostName(required) -n existNodeHostName(optional)

Examples

  1. Install grpcurl

  2. Start servers

# start three server processes
docker-compose build && docker-compose up
  1. Try!
# Check successor list for each node
grpcurl -plaintext localhost:26040 server.InternalService/Successors \
&& grpcurl -plaintext localhost:36040 server.InternalService/Successors \
&& grpcurl -plaintext localhost:46040 server.InternalService/Successors

# Check predecessor for each node
grpcurl -plaintext localhost:26040 server.InternalService/Predecessor \
&& grpcurl -plaintext localhost:36040 server.InternalService/Predecessor \
&& grpcurl -plaintext localhost:46040 server.InternalService/Predecessor

# Query
grpcurl -plaintext -d '{"key": "gord1"}' localhost:26041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord1"}' localhost:36041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord1"}' localhost:46041 server.ExternalService/FindHostForKey 

grpcurl -plaintext -d '{"key": "gord2"}' localhost:26041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord2"}' localhost:36041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord2"}' localhost:46041 server.ExternalService/FindHostForKey 

grpcurl -plaintext -d '{"key": "gord"}' localhost:26041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord"}' localhost:36041 server.ExternalService/FindHostForKey \
&& grpcurl -plaintext -d '{"key": "gord"}' localhost:46041 server.ExternalService/FindHostForKey 

How to build

make build

How to run tests

make test

About

implementation of Chord : a scalable peer-to-peer lookup protocol for internet applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages