MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: experimental
Implementation Database
Description Allows to store revision text in Apache Cassandra NoSQL database
Author(s) Max Semenik (MaxSemtalk)
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.


Download instructionsEdit

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.


  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 parametersEdit

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( '', '', ),
    'bar' => array( 'somehostname' ),