1 +------------------------------------------------------------------------+
2 | An implementation of the user counting algorithm suggested in |
3 | Tor Tech Report 2012-10-001 for later integration with metrics-web |
4 +------------------------------------------------------------------------+
6 Instructions (for Debian Squeeze):
8 Install Java 6 for descriptor parsing and PostgreSQL 8.4 for descriptor
9 data storage and aggregation:
11 $ sudo apt-get install openjdk-6-jdk postgresql-8.4
13 Create a database user and database:
15 $ sudo -u postgres createuser -P karsten
16 $ sudo -u postgres createdb -O karsten userstats
17 $ echo "password" > ~/.pgpass
18 $ chmod 0600 ~/.pgpass
19 $ psql -f init-userstats.sql userstats
21 Run unit tests using pgTAP:
23 $ sudo apt-get install pgtap
24 $ psql -c 'CREATE SCHEMA tap;' userstats
25 $ PGOPTIONS=--search_path=tap psql -d userstats \
26 -f /usr/share/postgresql/8.4/contrib/pgtap.sql
27 $ pg_prove -d userstats test-userstats.sql
29 Create empty bin/, lib/, in/, status/, and out/ directories.
31 Put required .jar files into the lib/ directory. See metrics-lib.git for
34 - lib/commons-codec-1.6.jar
35 - lib/commons-compress-1.4.1.jar
38 Run the run-userstats.sh script:
44 Advanced stuff: the database can also be initialized using descriptor
45 archives available at https://metrics.torproject.org/data.html. Only
46 relay consensuses, relay extra-info descriptors, and bridge descriptors
47 are required. Put them into the following directories, ideally after
48 decompressing (but not extracting them) using bunzip2:
50 - in/relay-descriptors/ (consensuses-*.tar and extra-infos-*.tar)
51 - in/bridge-descriptors/ (bridge-descriptors-*.tar)
53 Also comment out the rsync command in run-userstats.sh and add a
54 --stats-date parameter to the java line (see commented out line). Then
55 run run-userstats.sh. After initializing the database, clean up the in/
56 and out/ directory and don't forget to put back the rsync command in
57 run-userstats.sh. It may be easier to set up separate instances of this
58 tool for initializing the database and for running it on a regular basis.