Running DHT shells

[English | Japanese]
last-updated: February 13, 2011

In this tutorial, you invoke multiple instances of DHT shell and use DHT via the shells. Required number of computers is one.

The following instructions assume that you have the toolkit installed (extracted and built), and set PATH environment variable to execute toolkit commands in bin directory. You can execute the commands without setting the PATH by preceding the commands with the path of the bin directory.

Construct an overlay

On a character terminal, type the following command to invoke the first DHT shell:
Open another character terminal and invoke the second DHT shell with the contact.
owdhtshell <hostname or IP address of the computer>
The shell prompts you to give a command by showing "Ready."
Now you can type any shell command. Type the help command.
And you see help messages:
status [<verbose level>]
init [-status] <host>[:<port>] [<port>]
get [-status] <key> [<key> ...]
put [-status] <key> <value> [<value> ...] [- <key> <value> [<value> ...] ...]
remove|delete [-status] <secret> <key> [<value> ...] [- <key> [<value> ...] ...]
Type the status command.
And you see routing table of the node like the followings:
ID and address: 4c14c60f7ee61d12bb08f7abdf4d22864b5930bf:hostname/XXX.XXX.XXX.XXX:3997
Routing table:

Put and get a value

Type the following command to put a value to DHT.

put foo bar

Try the status command to see the result of routing for the put.

Last keys & routes: 
number of messages: 0 -> 0
key[0]: 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33
route[0] (length: 1): [
 4c14c60f7ee61d12bb08f7abdf4d22864b5930bf:hostname/XXX.XXX.XXX.XXX:3997 (0)
 4c14c60f7ee61d12bb08f7abdf4d22864b5930bf:hostname/XXX.XXX.XXX.XXX:3997 (91)
You see the key foo is hashed to 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 and the route length was 1.

Type the following command to get the value you have put.

get foo
You see the value bar you have put.
key:   0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33
value: bar 10782
The number 10782 is the TTL. It is the remaining lifetime of the foo-bar pair.

Halt the nodes

Type the halt command to stop the node controlled by the shell.


Default routing algorithm and routing style are Chord and iterative routing. You can change them by specifying options to DHT shell. See the manual page.
Return to Documents page
Return to Overlay Viewer main page