UserManual

From Clairv

Jump to: navigation, search

Contents

Baisc Usage

Discusses using Clairv in a typical B/S or just local environment.

Advanced Usage

Searching on P2P Overlays

Currently Clairv uses FreePastry to build the underlying overlay.

Starting the Pastry broker

In order to enable the peer-to-peer search feature, you have to first start the Pastry broker.

The Clairv P2P package offers startup scripts for both Windows and *NIX-like platforms. Note that currently our Windows startup batch file only supports Windows XP or higher versions. This limitation will be resolved in the future.

The Pastry broker startup script is "start-broker.bat" on Windows and "start-broker.sh" on *NIX-like platforms. This command supports the following arguments:

argument description required?
-p, --port <arg> specifies the Pastry port yes
-b, --boothandle <arg> specifies the remote boot handle (in host:port form) no
-i, --pipe <arg> specifies the local pipe port yes when run at the first time
-c, --clientport <arg> specifies the client pipe port yes when run at the first time
--help prints the help message no
-D<property=value,...> provides additional properties to the broker no

Here we see three kinds of ports:

  • Pastry port (specified by the -t option): the Pastry overlay network uses this port to do peer-to-peer communication, based on which the DHT functionality is provided.
  • local pipe port (specified by the -i option): the broker uses this port to receive messages from the client API.
  • client pipe port (specified by the -c option): the broker forwards the messages to the client API on this port. This port number should be the same as the configuration on the client side.

Additionally there is a "-b" or "--boothandle" option. This option lets you to specify the bootstrap node. A bootstrap node is a node that is already in a Pastry ring. It gives a new node enough knowledge about current network neighborhood and helps it to join the Pastry ring. If no bootstrap node is provided, the broker will start a new Pastry ring. The boothandle argument is given as "host:port" form, e.g., 192.168.1.123:10000. Here the port 10000 corresponds to the Pastry port (-p) argument.

The "-D" option supports the following syntax: start-broker.bat -Dpropert1=value1,property2=value2

Particularly, if you are using the broker in an NATed LAN (possibly behind a router), you have to add pastry.nat_search_policy=never to the -D option.

So generally if you might be using the the following command to start a Pastry broker

start-broker.bat -Dpastry.nat_search_policy=never -p 10000 -i 11000 -c 9000

You may run multiple instances of the broker by using different combination of port numbers that are not conflicting.

Configuring the client API

The PastryNetwork class is the client that interacts with the broker. It needs two properties in order to run.

  • pastrybroker.clientport