Q is a distributed Peer2Peer file storage/retrieval network that aims to deliver optimal performance by respecting the properties of the I2P network.
This manual serves as a 'walkthrough' guide, to take you through the steps from initial download, to everyday usage. It also provides information for the benefit of higher-level client application authors.
OK, we assume here that you've already cracked the tarball, and are looking at the distribution files.
In order to get Q set up and running, you'll need:
- An I2P router installed, set up and (permanently or transiently) running
- Your system shell set up with at the environment variables:
- CLASSPATH - this should include:
- The regular I2P jar files and 3rd party support jar files (eg i2p.jar, i2ptunnel.jar, streaming.jar, mstreaming.jar, jbigi.jar)
- Apache's XML-RPC support jarfile - included in this Q distro as xmlrpc.jar
- Aum's jarfile aum.jar, which includes Q and all needed support code
- PATH - your execution search path must include the directory in which your main java VM execution program (java, or on windows systems, java.exe) resides.
NOTE - if java[.exe] is not on your PATH, then Q will not run.
Nearly everyone will want to run a Q Client Node.
It is only client nodes which provide users with full access to the Q network.
However, if you have a (near-) permanently running I2P Router, and you're a kind and generous soul, you might also be willing to run a Q Server Node in addition to your Q Client Node.
If you do choose to run a server node, you'll be expected to keep it running as near as possible to 24/7. While transience of client nodes - frequent entering and leaving the Q network - causes little or no disruption, transience of server nodes can significantly impair Q's usability for everyone, particularly if this transience occurs frequently amongst more than the smallest percentage of the server node pool.
Until you're feeling well "settled in" with Q, your best approach is to just run a client node for now, and add a server node later when you feel ready.
This chapter discusses the deployment and usage of a Q Client Node, and will take you through the steps of:Setup and running of Q Server Nodes will be discussed in a later chapter.
- Double-checking that you've met the installation requirements
- Launching a Q Client Node
- Verifying that your Q Client Node is running
- If your node fails to launch, figuring out why
- Importing one or more noderefs into your node
- Observing that your node is discovering other nodes on the network
- Observing that your node is discovering content on the network
- Searching for items of content that match chosen criteria
- Retrieving stuff from the network
- Inserting stuff to the network
- Shutting down your client node
Ensure that all the needed I2P jarfiles, as well as xmlrpc.jar and Q's very own aum.jar are correctly listed in your CLASSPATH environment varaible, and your main java launcher is correctly listed in your PATH environment variable.
Typically, you will likely copy the jarfiles aum.jar and xmlrpc.jar into the lib/ subdirectory of your I2P router installation, along with all the other I2P jar files. Wherever you choose to put these files, make sure they're correctly listed in your CLASSPATH.
Also, you'll want to add execute permission to your qmgr (or qmgr.bat) wrapper script, and copy it into one of the directories listed in your PATH environment variable.
qmgr (or qmgr.bat) is a convenience wrapper script to save your sore fingers from needless typing. It's just a wrapper which passes arguments to the java commandjava net.i2p.aum.q.QMgr
You can verify you've set up qmgr correctly with the command:This displays a brief summary of qmgr commands. On the other hand, the command:
qmgr helpfloods your terminal window with a detailed explanation of all the qmgr commands and their arguments.
qmgr help verbose
Provided you've successfully completed the preliminaries, you can launch your Q Client Node with the command:All going well, you should have a Q Client Node now running in background.
qmgr start
After typed the qmgr start command, you will see little or no evidence that Q is actually running.
You can test if the node is actually up by typing the command:If your Q Client Node is running, this status command should produce something like:
qmgr statusIf you see something like this, then smile, because Q is now up on your system.
Pinging node at '/home/myusername/.quartermaster_client'... Node Ping: status=ok numPeers=0 dest=-3LQaE215uIYwl-DsirnzXGQBI31EZQj9u~xx45E823WqjN5i2Umi37GPFTWc8KyislDjF37J7jy5newLUp-qrDpY7BZum3bRyTXo3Udl8a3sUjuu4qR5oBEWFfoghQiqDGYDQyJV9Rtz7DEGaKHGlhtoGsAYRXGXEa8a43T2llqZx2fqaXs~836g8t6sLZjryA5A9fpq98nE5lT0hcTalPieFpluJVairZREXpUiAUmGHG7wAIjF6iszXLEHSZ8Qc622Xgwy0d1yrPojL2yhZ64o05aueYcr~xNCiFxYoHyEJO3XYmkx~q-W-mzS3nn6pRevRda74MnX1~3fFDZ0u~OG6cLZoFkWgnxrwrWGFUUVMR87Yz251xMCKJAX6zErcoGjGFpqGZsWxl4~yq7yfkjPnq3GuTxp2cB75bRAOZRIAieqBOVJDEodFYW5amCinu4AxYE7G1ezz4ghqHFe~0yaAdO74Q1XoUny138YT6P33oNOOlISO1cAAAA uptime=4952 load=0.0 id=6LVZ9-~GgJJ52WUF1fLHt3UnH50TnXSoPQXy7WZ4GA= numLocalItems=47 numRemoteItems=2173
If the node launch failed, you might see something like:This indicates that your Q client node has either crashed, or failed to launch in the first place.
Pinging node at '/home/myusername/.quartermaster_client'... java.io.IOException: Connection refused at org.apache.xmlrpc.XmlRpcClient$Worker.execute(Unknown Source) at org.apache.xmlrpc.XmlRpcClient.execute(Unknown Source) at net.i2p.aum.q.QMgr.doStatus(QMgr.java:310) at net.i2p.aum.q.QMgr.execute(QMgr.java:813) at net.i2p.aum.q.QMgr.main(QMgr.java:869) Failed to ping node
If you're having trouble like this, you might like to try running your Q client node in foreground, instead of spawning it off into background.
The command to run a Q client node in foreground is:You should see some meaningless startup messages, and no return to your shell prompt.
qmgr foreground
By default, when you run a Q Client Node, it creates a datastore directory tree at ~/.quartermaster_client. (Windows users note - you'll find this directory wherever your user home directory is - this depends on what version of Windows you have installed).
Within this directory tree, you should see a file called node.log, which will contain various debug log messages, and can help you to rectify any problems with your Q installation. If you hit a wall and can't rectify the problems yourself, you should send this file to the Q author (aum).
It's possible to run your Q node from another directory, by passing that directory as a -dir <path> argument to the qmgr start, foreground and stop commands. See qmgr help verbose for more information.
Note from the prior qmgr status command the line:This means that your Q client node is running standalone, and doesn't have any contact with any Q network. As such, your node is effectively useless. We need to hook up your node with other nodes in the Q network.
numPeers=0
Q doesn't ship with any means for new client nodes to automatically connect to any Q server nodes. This is deliberate.
In all likelihood, there will be one 'main' Q network running within I2P, largely based around the author's own Q server node, and most people will likely want to use this Q network. But the author doesn't want to stop other people running their own private Q networks, for whatever purpose has meaning for them.Ok, getting back on topic - your brand new virgin Q client node is useless and lonely, and desperately needs some Q server nodes to talk to. So let's hook up your node to the mainstream Q network.
This is especially relevant for Q as opposed to Freenet. With Freenet, there's no way for a user to know of the existence of any item of content without first being given its 'key'. However, since Q works with published catalogs, any user can know everything that's available on a Q network, which might not be desirable to those wishing to share content in a private situation.
The Q author anticipates, and warmly supports, people running their own private Q networks within I2P, in addition to accessing the mainstream 'official' Q network.
The way Q is designed and implemented, there is no way for anyone, including Q's author, to know of the existence of anyone else's private Q network. It is beyond the author's control, (and thus arguably the author's legal responsibility), what private Q networks people set up, and what kind of content is trafficked on these networks. This claim of plausible deniability on the part of Q's author parallels that of a hardware retailer denying responsibility for what people do with tools that they purchase.
You'll need to get one or more 'noderefs' for Q server nodes.
There's nothing fancy about a Q noderef. It's just a regular I2P 'destination', with which your Q Client Node can connect with a Q Server Node.
A 'semi-official' list of noderefs for the mainstream Q network can be downloaded from the url: http://aum.i2p/q/qnoderefs.txt.
Download this file, save it as (say) qnoderefs.txt. (Alternatively, if you're wanting to subscribe into a private Q network, then get a noderef for at least one of that network's server nodes from someone on that network who trusts you).
Import these noderefs into your Q client node via the command:If all goes well, you should see no output from this command, or (possibly) a brief line or two suggesting success.
qmgr addref qnoderefs.txt
Your client node is now subscribed into the Q network of your choice. Verify this with the command:In the output from that command, you should see the numPeers= line showing at least 1 peer.
qmgr status
If there is more than one Q Server Node on the Q network you've just subscribed to, then your local node should sooner or later discover all these server nodes, and the numPeers value should increase over time.
When your client node gets its noderefs to a Q network, it will periodically, from then on, retrieve differential peer list and catalog updates from servers it knows about.
While Q is in its early development and testing stages, the author may abdicate the mainstream Q network, and publish nodrefs for a whole new mainstream Q network. This will especially happen if the author makes any substantial changes to the inter-node protocol, and/or releases incompatible new versions of Q client/server nodes. Remember that http://aum.i2p/q/qnoderefs.txt will serve as the authoritative source for noderefs for the mainstream Q network within the mainstream I2P network.
Even if you only feed your client just one ref for a single server node, it will in time discover all other operating server nodes on that Q network, and will build up a full local catalog of everything that's available on that Q network.
Provided that your client is running ok, and has been fed with at least one ref for a live Q network that contains content, then over time, successive:commands should report increasing values in the fields:
qmgr status
- numPeers - number of peers this client node knows about
- numLocalItems - number of locally stored content items, ie items which you have either inserted to, or retrieved from, your client node
- numRemoteItems - number of unique data items which are available on remote server nodes in the Q network, and which can be retrieved through your local client node.
4.7.1. One Big Warning
If you are participating in more than one distinct Q network, then do not insert noderefs for different networks into the same running instance of a local Q client, unless you don't plan on inserting content via that client.
For instance, let's say you are participating in two different Q networks:If you get a noderef for both these networks, and insert both of these into the same running Q client node, then this local client node will be transparently connected to both networks.
- The 'mainstream' Q netowrk
- A secret Q network - "My friends' teen angst diaries"
If you only ever plan on retrieving content, and never inserting content, this won't be a problem, except that you won't be able to tell which content resides on the mainstream Q network, and which resides in the secret Q network.
The big problem arises from inserting content. Whenever you insert data through this 'contaminated' Q client node, this node picks 3 different servers to which upload a copy of this data. You won't have any control over whether the data gets inserted to the mainstream Q network, or your secret Q network. You might insert something sensitive, intending it to go only into the secret Q network, where in fact it also ends up in the mainstream network, with consequences you might not want.
Whenever content gets stored on Q, it is actually stored as two separate items:Metadata consists of a set of category=value pairs.
- The raw data - whether a text file, or the raw bytes of image files, audio files etc
- The metadata, which contains human-readable and machine-readable descriptions of the data
Confused yet? Don't worry, I'm confused as well. Let's illustrate this with an example of metadata for an MP3 audio recording:All metadata categories are optional. In fact, you can insert content with no metadata at all.
- title=Fight_Last_Thursday.mp3
- type=audio
- mimetype=audio/mpeg
- abstract=upcoming single recorded in our garage last April
- keywords=grunge,country,indie
- artist=Ring of Fire
- size=4379443
- contact=ring-of-fire@mail.i2p
- key=blah37blah24-yada23hfhyada
If you fail to provide metadata when inserting an item, a blank set of metadata will be created with at least the following categories:Within Q, there is a convention to supply a minimal amount of metadata. While this is not expected or enforced, including all these categories is most strongly recommended. These core categories are:
- key - the derived key, under which the item will later be retrievable by yourself and others
- title - if not provided at insert time, this will be set to the key
- size - size of the item's raw data, in bytes
Note that you can supply extra metadata categories in addition to the above, and that people searching for content can search on these extra categories if they know about them.
- title - a meaningful title for the data item, consisting only of characters which are legal in filenames on all platforms, and which ends with a file extension.
- type - one of a superset of eMule classifiers, such as:
- text - plain text
- html - HTML content
- image - content is in an image format, such as .png, .jpg, .gif etc
- audio - content is an audio sample, such as .ogg, .mp3, .wav etc
- video - due to the sheer size of video files, and Q's present design, it's unlikely people will be inserting video content anytime soon (unless it's very short)
- archive - packed file collections, such as .tar.gz, .zip, .rar etc
- misc - content does not fit into any of the above categories
- mimetype - not as important as the type category, but providing this category in your metadata is still strongly encouraged. Value for this category should be one of the standard mimetypes, eg text/html, audio/ogg etc.
- abstract - a short description (<255 characters), intended for human reading
- keywords - a comma-separated list of keywords, intended for machine-readability, should be all lowercase, no spaces
As mentioned earlier - in constrast with Freenet, local Q nodes build up a complete catalog of all available content on whatever Q network they are connected to.
This is a design decision, based on the choice to eliminate query traffic.
The author hopes that this will result in a distributed storage network with a high retrievability guarantee, in contrast with freenet which offers no such guarantee.
With Freenet, you only ever know of the existence of something if someone tells you about it.
But with Q, your local client node builds up a global catalog of everything that's available within the whole network.
The QMgr client has a command for searching your Q client node:For example:
qmgr search -m category1=pattern1 category2=pattern2 ...or:
qmgr search -m type=audio artist=Mozart keywords=symphonyAs implied in the latter example, search patterns are regular expressions. This example will locate all text items, whose title metadata category contains one of bible, biblical or Nag Hammadi, and whose keywords category contains either or both the words apocrypha or Magdalene.
qmgr search -m type=text title="bible|biblical|(Nag Hammadi)" keywords="apocrypha|Magdalene"
Please use the search function carefully, otherwise (if and when Q usage grows) you could be inundated with thousands or even millions of entries.
If a search turns up nothing, qmgr will simply exit. But if it turns up one or more items, it will the items out one at a time, with the key first, then each metadata entry on an indented line following.
Now, we're actually going to retrieve something.
Presumably, after following the previous section, you will have seen one or more search results come up, with the 'keys' under which the items can be accessed.
Now, choose one of the keys, preferably for a short text item. Try either of the following commands:or:
qmgr get <keystring> something.txt(both have the same effect - the first one explicitly writes to the named file, the second one dumps the raw data to stdout, which we shell-redirect into the file.
qmgr get <keystring> > something.txt
Note - redirection of fetched data to a file via shell is not working at present. Use only the first form till we fix the bug.
Our last example in this walkthrough relates to inserting content.
Firstly, create a small text file with 2-3 lines of text, and save it as (say) myqinsert.txt.
Now, think of some metadata to insert along with the file. Or, you can just use the set:Now, let's insert the file. Ensure your Q client node is running, then type:
type=text keywords=test abstract=My simple test of inserting into Q title=myqinsert.txtIf all went well, this command should produce half a line of gibberish, followed immediately by your shell prompt, eg:
qmgr put myqinsert.txt -m type=text keywords=test title="myqinsert.txt" \ abstract="My simple test of inserting into Q"The '$' at the end is your shell prompt, and all the characters before it are the 'key' which was derived from the content you just inserted.
aRoFC~9MU~pM2C-uCTDBp5B7j79spFD8gUeu~BNkUf0=$
To avoid the hassle of copying/pasting the key, you could just add output redirection to the above command, eg:This will cause the generated key to be written safe and sound into the file myqinsert.key.
qmgr put myqinsert.txt -m type=text keywords=test title="myqinsert.txt" \ abstract="My simple test of inserting into Q" \ > myqinsert.key
You can verify that this insert worked by a 'get' command, as in:(Note that this won't work on windows because the DOS shell is irredeemably brain-damaged. If you're using Windows, you will have to cut/paste the key.
qmgr get `cat myqinsert.key` somefilename.ext
If you've worked through to here, then congratulations! You've got your Q Client Node set up and working, and ready to meet all your distributed file storage and retrieval needs.
You can leave your client node running 24/7 if you want. In fact, we recommend you keep your client node running as much of the time as possible, so that you get prompt catalog updates, and can more quickly stay in touch with new content.
However, if you need to shut down your node, the command for doing this is:This command will take a while to complete (since the node has to wait for the I2P java shutdown hooks to complete before it can rest in peace). But once your node is shut down, you can start it up again at any time and pick up where you left off.
qmgr stop
This section describes the requirements for, and procedures involved with, running a Q Server Node.
We'll use a similar 'walkthrough' style to that which we used in the previous section on client nodes.
Running a Q server is a generous thing to do, and helps substantially with making Q work at its best for everyone. However, please do make sure you can meet some basic requirements:Also, please decide whether you want your server node to contribute to the mainstream Q network, or whether you want to create your own private Q network, or join someone else's private network. Your contribution will be most appreciated, though, if you can run a server within the mainstream Q network.
- You are running a permanent (24/7) I2P Router, on a box with at least (say) 98% uptime.
- You have a little bandwidth to spare, and don't mind the extra memory, disk and CPU-usage footprint of running a fulltime Q server node
- You have already been able to successfully run a Q client node.
Starting up a Q Server node is very similar to starting up a Q client node, except that with the qmgr command line, you must put the keyword arg server before the command word. So the command is:Similar to Q client nodes, you can check the status of a running Q server node with the command:
qmgr server start(Note that this command will take longer to complete than with client nodes, because the communication passes through a multi-hop I2P tunnel, rather than just through localhost TCP).
qmgr server status
If the status command succeeds, then you'll know your new Q Server Node is happily running in background.
When a Q Server node starts up for the first time, it is in a private network all by itself.
If you want to link your server into an existing Q network, you'll have to add a noderef for at least one other server on that network. The command to do this is similar to that for subscribing a client node to a network:where <noderef-file> is a file into which you've saved the noderef for the network you want to join.
qmgr server addref <noderef-file>After you've added the noderef, subsequent qmgr server status commands should show numPeers having a value of at least 1 (and growing, as more server nodes come online in the mainstream Q network.)
Recall from the section on client nodes that the authoritative noderefs for the mainstream Q network can be downloaded from http://aum.i2p/q/qnoderefs.txt.
If you're planning to start your own private Q network, and want to include other server operators in this network, then you'll have to export your server's noderef and make it available to the others you want to invite into your network.
The command to export your Q Server noderef is:This will extract the I2P Destination of your running server node, and write it into <noderef-file>. You can then privately share this file with others who you want to invite into your private network. Each recipient of this file will do a qmgr server addref <noderef-file> command to import your ref into their servers.
qmgr server getref <noderef-file>
Don't forget that if you're running, or participating in, a private Q network, then you'll need to run a separate client for accessing this network, separate from any mainstream Q network client you may already be running.
To start this extra client, you'll have to choose a directory where you want this client to reside, a port number you want your client to listen on locally for user commands, and run the command:You need the -port <portnum> command, because otherwise it'll fail to launch (if you already have a client node running off the mainstream Q network).
qmgr -dir /path/to/my/new/client -port <portnum> start
This will create, and launch, a new instance of a Q client, accessing your private Q network. Don't forget to import your server's noderef into this client. Also, note that you'll have to use this same -port <portnum> argument when doing any operation on this client instance, such as get, put, status, search.
qmgr help
for a quick help summary, or:
qmgr help verbose
for the 'War and Peace' treatise.
One crucial concept to remember with qmgr is that client and server node instances are uniquely identified by the directories at which they reside. If you are running multiple server and/or client instances, you can specify an instance with the -dir <dirpath> option - see the help for details.