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.
owdhtshell
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."
help
And you see help messages:
Type the status command.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> ...] ...] ...
status
And you see routing table of the node like the followings:
ID and address: 4c14c60f7ee61d12bb08f7abdf4d22864b5930bf:hostname/XXX.XXX.XXX.XXX:3997 Routing table: ...
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.
status
You see the key foo is hashed to 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 and the route length was 1.... 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) ] ...
Type the following command to get the value you have put.
get foo
You see the value bar you have put.
The number 10782 is the TTL. It is the remaining lifetime of the foo-bar pair.key: 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 value: bar 10782
halt