Super Columns
Super columns bring an extra level of nesting to the data model.
Super columns must be completely serialized and de-serialized to be accessed. This makes them inefficient for super columns with a large number of columns. While super columns look like an attractive option, it is almost always better to append the column and the super column together with a deliminator between them. The extra serialization involved in using super columns and extra space used makes them less efficient.
Download pre-3.0 Cassandra for CLI
mkdir -p /home/hadoop/AdithyaJ/Cassandra
cd /home/hadoop/AdithyaJ/Cassandra
wget http://archive.apache.org/dist/cassandra/0.7.2/apache-cassandra-0.7.2-bin.tar.gz
tar -xvzf apache-cassandra-0.7.2-bin.tar.gz
cd apache-cassandra-0.7.2/
Start Cassandra
bin/cassandra
The stack size specified is too small, Specify at least 228k
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
vim conf/cassandra-env.sh
if [ "`uname`" = "Linux" ] ; then
# reduce the per-thread stack size to minimize the impact of Thrift
# thread-per-client. (Best practice is for client connections to
# be pooled anyway.) Only do so on Linux where it is known to be
# supported.
JVM_OPTS="$JVM_OPTS -Xss256k"
fi
bin/cassandra
CLI operations with super columns
Start CLI
cd /home/hadoop/AdithyaJ/Cassandra/apache-cassandra-0.7.2/
bin/cassandra-cli --host 127.0.0.1
Connected to: "Test Cluster" on 127.0.0.1/9160
Welcome to cassandra CLI.
Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit.
[default@unknown]
Create Super Column
create keyspace testkeyspace with replication_factor=1;
use testkeyspace;
create column family supertest with column_type='Super';
Insert Data
set supertest['mynewcar']['parts']['engine']='v8';
set supertest['mynewcar']['parts']['wheelsize']='20"';
set supertest['mynewcar']['options']['cruise control']='yes';
set supertest['mynewcar']['options']['heated seats']='yes';
Use assume to format the columns as ASCII text
assume supertest comparator as ascii;
assume supertest sub_comparator as ascii;
assume supertest validator as ascii;
get supertest['mynewcar'];
=> (super_column=options,
(column=cruise control, value=yes, timestamp=1528360888680000)
(column=heated seats, value=yes, timestamp=1528360889719000))
=> (super_column=parts,
(column=engine, value=v8, timestamp=1528360840007000)
(column=wheelsize, value=20", timestamp=1528360888675000))
Returned 2 results.