I recently setup a Cassandra environment for a customer, the easiest approach was to utilize the DataStax Yum repository which is detailed below. As detailed previously there is a compatability issue with the OpenJDK default in CentOS so first follow my previous post on installing the Oracle JDK.
Installation
-
As root create /etc/yum.repos.d/datastax.repo:
[datastax]
name= DataStax Repo for Apache Cassandra
baseurl=http://rpm.datastax.com/community
enabled=1
gpgcheck=0
- To install Cassandra, for Apache Cassandra 1.2.x:
sudo yum install cassandra12
- Install a copy of JNA jar just for Cassandra
Note: JNA from base repo is 3.2.4 while Cassandra requires 3.2.7+
cd /usr/share/cassandra/lib
sudo wget https://maven.java.net/content/repositories/releases/net/java/dev/jna/jna/3.5.1/jna-3.5.1.jar
sudo chown cassandra:cassandra jna-3.5.1.jar
sudo chown 755 jna-3.5.1.jar
- Fix permissions
sudo chown -R cassandra:cassandra /var/lib/cassandra
sudo chown -R cassandra:cassandra /var/log/cassandra
Configuration
- Create /etc/profile.d/cassandra.sh
export CASSANDRA_HOME=/usr/share/cassandra
- Load into current session:
source /etc/profile.d/cassandra.sh
- Edit the following settings in /etc/cassandra/conf/cassandra.yaml:
cluster_name: '
'
...
- seeds: ""
...
listen_address:
...
rpc_address: 0.0.0.0
Note: for more details about configuring and optimizing a multi-node cluster, see sources. - Open ports
7199 for JMX
9160 for Cassandra Thrift
7000 for Cassandra Gossip
- Start cassandra:
sudo service cassandra start
- Start cassandra on boot:
sudo chkconfig cassandra on