Tuesday, 18 August 2015

Installing Cassandra on ubantu

Standard




Prerequisite already installed Java

java -version
echo $JAVA_HOME
 
 

 Installing Cassandra
To install Cassandra, download the binary files from the website, unpack them and move it to your personal folder:

cd ~/temp
wget http://www.us.apache.org/dist/cassandra/1.2.16/apache-cassandra-1.2.16-bin.tar.gz
tar -xvzf apache-cassandra-2.2.0-bin.tar.gz
 
 mv apache-cassandra-2.2.0 ~/cassandra
 
Next, make sure that the folders Cassandra accesses, such as the log folder, exists and that Cassandra has the right to write on it:

sudo mkdir /var/lib/cassandra
sudo mkdir /var/log/cassandra
sudo chown -R $USER:$GROUP /var/lib/cassandra
sudo chown -R $USER:$GROUP /var/log/cassandra
 
Now set Cassandra’s variables by running:
export CASSANDRA_HOME=~/cassandra
export PATH=$PATH:$CASSANDRA_HOME/bin
 
You’re going to need to configure Cassandra’s per-thread stack size to a larger one than default. Do so by running:

nano ~/cassandra/conf/cassandra-env.sh
 
and scrolling down to the line that says:

JVM_OPTS="$JVM_OPTS -Xss180k"
and changing it to:
JVM_OPTS="$JVM_OPTS -Xss280k"
like the image below:
Simply press CTRL+O to save and CTRL+X to exit.


Running Cassandra
To run a single-node test cluster of Cassandra, you aren’t going to need to change anything on the cassandra.yaml file. Simply run:
sudo sh ~/cassandra/bin/cassandra
 
and then run:
sudo sh ~/cassandra/bin/cassandra-cli
and if it says "Connected to: 'Test Cluster'" as it does on the image below, you are now running your single-node cluster.

0 comments:

Post a Comment