Basic Cassandra commands

The following commands and shell options are used with Cassandra 2.2 and 3.x.

Increase Request Timeout for local database connection

The following option increases the request timeout for the current session.

./cassandra/bin/cqlsh --request-timeout=3600

Clear all former snapshots

./cassandra/bin/nodetool clearsnapshot

Increase Heap size for local session (mostly development)

MAX_HEAP_SIZE=8g HEAP_NEWSIZE=2g ./cassandra/bin/cassandra -f

Starting and connecting local cassandra instance

# Startup
./cassandra/bin/cassandra -f

# Connect
./bin/cqlsh localhost

Show all Keysapces

DESCRIBE KEYSPACES;

Show all tables of a Keyspace

DESCRIBE KEYSPACE keyspaceName;

Set a Keyspace as current working space

USE keyspaceName;

Exchange data between paragraphs of Spark and Flink interpreters with InterpreterContext within Apache Zeppelin

If you have to exchange data from Flink to Spark or Spark to Flink within Apache Zeppelin, you can use the InterpreterContext to store and reload data between the separated paragraphs.

You can load the InterpreterContext within Spark paragraph and store the relevant data within:

%spark

import org.apache.zeppelin.interpreter.InterpreterContext
 
val resourcePool = InterpreterContext.get().getResourcePool()
 
val n = z.select("name",Seq(("foo", "foo"), ("bar", "bar")))
 
resourcePool.put("name", n)

Within another paragraph that loads the Flink interpreter, you can load the InterpreterContext and use the stored information.

%flink
 
import org.apache.zeppelin.interpreter.InterpreterContext
 
val resourcePool = InterpreterContext.get().getResourcePool()
 
resourcePool.get("name").get.toString