A library for writing Heritrix 3 output directly to Cassandra as records.
- Visit http://github.com/openplaces/heritrix-cassandra/tree/master/releases/ and obtain a release of heritrix-cassandra that corresponds to the versions of Heritrix and Cassandra you are running. Consult the "Releases" section for more information.
- Copy the heritrix-cassandra-{version}.jar file into your Heritrix install's lib folder.
- Modify your Heritrix job configuration to use the heritrix-cassandra writer
crawler-beans.cxml:
<!-- DISPOSITION CHAIN --> <bean id="cassandraParameters" class="org.archive.io.cassandra.CassandraParameters"> <!-- "seeds" and "keyspace" are required, while port defaults to 9160 --> <!-- Pass a comma-separated list of servers to Cassandra here --> <property name="seeds" value="localhost,127.0.0.1" /> <!-- This is the thrift port --> <property name="port" value="9160" /> <!-- Your application specific keyspace --> <property name="keyspace" value="MyApplication" /> <!-- Change the crawlColumnFamily from its default value of 'crawl' --> <property name="crawlColumnFamily" value="crawled_pages" /> <!-- Other parameters are overridden similarly and a full list is provided below --> </bean> <bean id="cassandraWriterProcessor" class="org.archive.modules.writer.CassandraWriterProcessor"> <property name="cassandraParameters"> <!-- Referencing the named bean we defined above --> <ref bean="cassandraParameters" /> </property> </bean> [...] <bean id="dispositionProcessors" class="org.archive.modules.DispositionChain"> <property name="processors"> <list> <!-- write to aggregate archival files... --> <ref bean="cassandraWriterProcessor"/> <!-- other references --> </list> </property> </bean>
Parameter | Default Value | Description |
---|---|---|
seeds | (none) | Comma-separated list of Cassandra servers (can be a list of any nodes in your cluster). |
port | 9160 | The Thrift port. |
keyspace | (none) | The name of your Cassandra keyspace. |
crawlColumnFamily | crawl | Name of the column family to use. |
encodingScheme | UTF-8 | Encoding scheme you're using. |
framedTransport | false | Whether to used Thrift's Framed Transport |
contentPrefix | content | Name of the logical prefix used to save the raw content to. If contentColumnName is redefined, then this prefix will be overridden and no longer used. |
contentColumnName | raw_data | Name of the column used to save the raw content to. |
curiPrefix | curi | Name of the logical prefix used to store the metadata related to the crawl. If any of the following parameters are redefined, then this prefix will be overridden and no longer used with it. |
ipColumnName | ip | Name of the column used to save the resolved ip to. |
pathFromSeedColumnName | path-from-seed | Name of the column used to save the path from the seed to. |
isSeedColumnName | is-seed | Name of the column used to store the boolean of whether the current entry is a seed. |
viaColumnName | via | Name of the column used to store the via information. |
urlColumnName | url | Name of the column used to store the url. |
requestColumnName | request | Name of the column used to store the request header. |
If you can't find a release that corresponds to your combination of Heritrix and Cassandra versions, then you can build your own version of heritrix-cassandra (granted that the APIs of each application haven't changed dramatically).
- Obtain the heritrix-cassandra source by visiting http://github.com/openplaces/heritrix-cassandra
- Create a new folder in lib (e.g. cassandra-0.*.* or heritrix-3.*.*) containing all the necessary dependencies. Check the existing folders for the required jars.
- Edit build.xml and change the properties "version", "cassandra-version", "heritrix-version" accordingly.
- Run "ant" in the command line, and your new jar should be in the target folder.
Each release of heritrix-cassandra is compiled against different version combinations of Heritrix and Cassandra. The following table summarizes them.
heritrix-cassandra | Heritrix | Cassandra |
---|---|---|
0.7 | 3.0.1 | 0.6.5 |
0.5 | 3.0.0 | 0.6.1 |
0.4 | 3.0.0 | 0.6.1 |
0.3 | 3.0.0 | 0.6.0 |
0.2 | 3.0.0 | 0.6.1 |
0.1 | 3.0.0 | 0.6.0 |