Installing Apache Cassandra
Prerequisites for Installation
Cassandra requires the most stable version of Java 1.6 you can deploy. For Sun's jvm, this means at least u19; u21 is better. See Installing Java Development Kit (JDK) on Linux (for Linux) or Installing Java Development Kit (JDK) on Windows (for Windows) how to install JAVA in your environment.
Download Cassandra Kit
Download links for the latest stable release can always be found on the website.
Users of Debian or Debian-based derivatives can install the latest stable release in package form, see DebianPackaging for details.
Users of RPM-based distributions can get packages from Datastax.
If you are interested in building Cassandra from source, please refer to How to Build page.
For more details about misc builds, please refer to Cassandra versions and builds page.
Edit configuration files
Cassandra configuration files can be found in conf directory under the top directory of binary and source distributions. If you have installed cassandra from RPM packages, configuration files will be placed into/etc/cassandra/conf.
Edit cassandra.yaml
The distribution's sample configuration conf/cassandra.yaml contains reasonable defaults for single node operation, but you will need to make sure that the paths exist for data_file_directories, commitlog_directory, and saved_caches_directory.
Verify storage_port and rpc_port are not conflict with other service 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 will use rpc_port to connect to Cassandra.
It will be a good idea to change cluster_name to avoid unnecessary conflict with existing clusters.
initial_token. You can leave it blank, but I recommend you to set it to 0 if you are configuring your first node.
Edit log4j-server.properties
conf/log4j.properties contains a path for the log file. Edit the line if you need.
# Edit the next line to point to your logs directory log4j.appender.R.File=/var/log/cassandra/system.log
Edit cassandra-env.sh
There are lot of options to tune Cassandra to suit the requirements.
By default, Cassandra will allocate memory based on physical memory your system has. For example it will allocate 1GB heap on 2GB system, and 2GB heap on 8GB system. If you want to specify Cassandra heap size, remove leading pound sign(#) on the following lines and specify memory size for them.
#MAX_HEAP_SIZE="4G" #HEAP_NEWSIZE="800M"
If you are not familiar with Java GC, 1/4 of MAX_HEAP_SIZE may be a good start point for HEAP_NEWSIZE.
Cassandra will need more than few GB heap for production use, but you can run it with smaller footprint for test drive. If you want to assign 128MB as max, edit the lines as following.
MAX_HEAP_SIZE="128M" HEAP_NEWSIZE="32M"
We recommend to use at least "2048M" for MAX_HEAP_SIZE.
If you face OutOfMemory exceptions or massive GCs with this configuration, increase these values. Don't start your production service with such tiny heap configuration!
Start up Cassandra
And now for the moment of truth, start up Cassandra by invoking bin/cassandra -f from the command line. The service should start in the foreground and log gratuitously to standard-out. Assuming you don't see messages with scary words like "error", or "fatal", or anything that looks like a Java stack trace, then chances are you've succeeded. After starting the Cassandra server you will see it has started listening for thrift clients.
.... .... .... INFO 12:18:29,140 Listening for thrift clients...
Press "Control-C" to stop Cassandra.
If you start up Cassandra without "-f" option, it will run in background, so you need to kill 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.
<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 2.0.0 to Cassandra
Edit <MB_HOME>/repository/conf/advanced/qpid-virtualhosts.xml file to point to Cassandra server setup as above.
<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>
Copyright © WSO2 Inc. 2005-2013