Extension:Cassandra

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
Cassandra
Release status: experimental
Implementation Database
Description Allows to store revision text in Apache Cassandra NoSQL database
Author(s) Max Semenik (MaxSemtalk)
Latest version Lua error in Module:Extension at line 252: attempt to index local 'data' (a nil value).
MediaWiki 1.16+, may work on earlier version though not tested
PHP 5.2+
License WTFPL 2.0
Download Subversion [Help]
Browse source code
Translate the Cassandra extension if it is available at translatewiki.net
Check usage and version matrix.

What can this extension do?[edit]

This extension allows to offload revision text to Apache Cassandra, reducing the load on main database.

Usage[edit]

Download instructions[edit]

Download the extension from SVN and place it under $IP/extensions/Cassandra/. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation[edit]

  1. Download and install Thrift and Cassandra using these instructions.
  2. Build the Thrift to Cassandra bindings as explained in instructions above. If you're on Windows and can't build them, you can use files bundled with Cassandra in <cassandra path>/lib/. Copy them to <thrift root>/lib/php/src/packages/cassandra/.
  3. Download this extension and put it to <MediaWiki root>/extensions/Cassandra/.
  4. Add the following to LocalSettings.php:
require_once( "$IP/extensions/Cassandra/Cassandra.php" );
$wgThriftRoot = 'whatever directory your Thrift for PHP is installed';
# Configure external storage engines
$wgDefaultExternalStore = array( 'cassandra://<host>/<keyspace>' );

Where <host> is cluster name or host name of your Cassandra server (see $wgCassandraClusters below), and <keyspace> is keyspace (roughly, analog of "database" in traditional RDBMS terminology) to be used. See here for details on how $wgExternalStores works.

Configuration parameters[edit]

Name Default value Meaning
$wgThriftRoot '/usr/share/php/Thrift' Directory where Thrift bindings for PHP reside
$wgCassandraPort 9160 Port used for communicating with Cassandra. Must match <ThriftPort> in Cassandra's storage-conf.xml
$wgCassandraKeyPrefix $wgDBname String prepended to saved key names, can be used to distinct between different wikis, etc. Does not affect the already saved revisions.
$wgCassandraColumnFamily 'Standard1' Column family to be used for storing data
$wgCassandraReadConsistency 1 Read consistency, see http://wiki.apache.org/cassandra/API#ConsistencyLevel
$wgCassandraWriteConsistency 1 Write consistency, see http://wiki.apache.org/cassandra/API#ConsistencyLevel
$wgCassandraClusters array() List of clusters and hosts belonging to them, for example:
$wgCassandraClusters = array( 
    'foo' => array( '192.168.1.1', '192.168.1.2', ),
    'bar' => array( 'somehostname' ),
);