Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

hiddentrue

...

Cassandra

...

Cassandra is a highly-scalable, eventually consistent, distributed, structured key-value store which acts as the default, persistence storage for WSO2 MBMessage Broker. The Message Broker can also be configured to connect to an external Cassandra server instead of the in-built Cassandra server, which is not recommended when processing large volumes of queues in a typical production environment.

WSO2 recommends the following on an actual, production deployment:

  • Using anexternal server or cluster such as Cassandra or Zookeeper.
  • Have the external server on a separate machine or a dedicated VM instance and point to it from the Message Broker.

This section provides instructions to install, setup and point an external Cassandra server to a standalone WSO2 Message Broker instance.

Installation Prerequisites

Cassandra requires the most stable version of Java 1.6 for Sun JVM. (u19 or higher is recommended. u21 is best). For instructions on installing Java, refer to

Download Cassandra Kit

Edit Configuration Files

Cassandra configuration files can be found in $CARBON_HOME /repository/conf/etc directory of binary and source distributions.  If you have installed Cassandra from RPM packages, configuration files will be placed into /etc/cassandra/conf. Cassandra configurations can be done in the following files.

Edit cassandra.yaml

The default cassandra.yaml contains reasonable settings for single node operation. There are few settings that need to be verified:

  • Ensure that the paths exist for data_file_directoriescommitlog_directory, and saved_caches_directory.   
  • Verify storage_port and rpc_port do not conflict with other services on your computer.  By default, Cassandra uses 7000 for storage_port, and 9160 for rpc_port. The storage_port must be identical between Cassandra nodes in a cluster. Cassandra client applications use rpc_port to connect to Cassandra.   
  • It is recommended to change the default cluster_name to avoid conflicts with existing clusters.
  • initial_token can be left blank, but setting to 0 is recommended if you are configuring your first node.

Edit log4j-server.properties

$CARBON_HOME /repository/conf/log4j.properties file contains a path for the log file as required.

Code Block
# Edit the next line to point to your logs directory
log4j.appender.R.File=/var/log/cassandra/system.log

Edit cassandra-env.sh

By default, Cassandra allocates memory based on the physical memory capacity of your system.    For example, it will allocate 1GB heap on 2GB system, and 2GB heap on 8GB system. To specify Cassandra heap size, remove leading pound sign(#) on the following lines and specify memory size for them.

...

Although Cassandra can be run on smaller footprint for test drive, it needs more Giga Bytes of heap for production. For example, to assign 128MB 128 MB as maximum, edit the lines as follows.

...

It is recommend to use at least "2048M" for MAX_HEAP_SIZE. In case of OutOfMemory  exceptions (http://wiki.apache.org/cassandra/OutOfMemory) or massive GCs with this configuration, increase these values. 

Info
titleNote

Don't It is not recommended to start production services with small heap configurations.

Start Cassandra

Cassandra can be started by invoking bin/cassandra -f from the command line. The -f option enures that the service starts in the foreground and logs gratuitously to standard-out. If there are no messages with "errors", or words such as  "fatal" or that look like a Java stack traces, then you've succeeded. After starting the Cassandra server, it starts listening for thrift clients as follows.

...

Press "Control-C" to stop Cassandra.   If you start up Cassandra without "-f" option, it runs in the background, so you need to kill which requires killing the process to stop.

Instruct WSO2 MB to Use External Cassandra Server

Edit $CARBON_HOME/repository/conf/advanced/qpid-config.xml file to instruct WSO2 server to use external Cassandra Server.

Code Block
languagehtml/xml
<clustering>
    <enabled>false</enabled>       
    <OnceInOrderSupportEnabled>false</OnceInOrderSupportEnabled>
    <!--Are we running an External Cassandra server ? true|false-->
    <externalCassandraServerRequired>true</externalCassandraServerRequired>
    <!--Are we running an External Zookeeper server ? true|false -->
    <!--externalZookeeperServerRequired>false</externalZookeeperServerRequired-->

Point WSO2 MB to Cassandra

Edit $CARBON_HOME/repository/conf/advanced/qpid-virtualhosts.xml file to point to Cassandra server setup.

Code Block
languagehtml/xml
 <virtualhost>
        <name>carbon</name>
        <carbon>
           <store>
                <class>org.wso2.andes.server.store.CassandraMessageStore</class>
                <username>admin</username>
                <password>admin</password>
                <cluster>ClusterOne</cluster>
                <idGenerator>org.wso2.andes.server.cluster.coordination.TimeStampBasedMessageIdGenerator</idGenerator>
                <connectionString>localhost:9160</connectionString>
            </store>
...
Excerpt
hiddentrue

Instructions to install Cassandra. WSO2 Message Broker supports distributed message brokering facilitate by Andes which uses Cassandra as its storage.