A demo program for Distributed Hash Table, implemented Chord protocol in Python.
You'll need twisted installed as a development dependency. See twisted website for help.
At first, an initial node must be started by using -i or -initial argument. Then you can add other nodes.
python chord.py -i <nickname> [-s scale] [-IP ip] [-p port] python chord.py <nickname> [-IP ip] [-p port]
- Nicknames must be unique.
- The initial node's address must be 'localhost', 8470.
There's a GUI for a more convenient way to send and demonstrate query. You can run draw.py to start the GUI before node's start and it will listen to port 9000.
If you want to send a query through a node, just click the node and then input your query string. When finished, target node and a path the query went through these nodes will be displayed.
If there're too many lines on screen, you can enter space to redraw.
Using 3 console windows, run in each one:
python Draw.py python Chord.py -i nodeA -s 10 --IP 127.0.0.1 -p 8470 python Chord.py nodeB --IP 127.0.0.1 -p 8471
Any questions, feel free to contact us.