Apache Cassandra

Published by

Posted on January 26, 2019

Cassandra is great for storing unknown type and amounts of data. One of the key benefits I like it. When you update a row and the primary matches. It will only update that row instead of adding a new row. With Mysql you had to set the unique option on the column.

Git repo https://gitbox.apache.org/repos/asf?p=cassandra.git

Install steps

  • Setup the Cassandra repo
  • yum install cassandra
  • systemctl enable cassandra
  • systemctl start cassandra

log path /var/log/cassandra/
Config path /etc/cassandra/default.conf/

  • Enabling the cluster
  • Edit /etc/cassandra/default.conf/cassandra.yaml

Edit /etc/cassandra/default.conf/cassandra.yaml

  • Set seeds addresses
  • listen_address <main ip>
  • set start_rpc to true if you want to use cqlsh from another node
  • rpc_address <main ip>

if you receive a error when trying to use nodetool. You will need to edit /etc/cassandra/default.conf/cassandra-env.sh and change JVM_OPTS=”$JVM_OPTS -Djava.rmi.server.hostname=<main IP>”

Example commands

nodetool status – show the status of the nodes in the cluster

nodetool drain – dumps the memory from memtable to the local disk.

creating a new keyspace – create KEYSPACE IF NOT EXISTS openkb WITH replication = {‘class’: ‘SimpleStrategy’, ‘replication_factor’: 1};

creating a new table – create TABLE IF NOT EXISTS name text, email text, with (primary key (name));

https://www.digitalocean.com/community/tutorials/how-to-run-a-multi-node-cluster-database-with-cassandra-on-ubuntu-14-04

https://stackoverflow.com/questions/11681522/wildcard-search-in-cassandra-database

https://stackoverflow.com/questions/29121904/cassandra-cqlsh-connection-refused