Cassandra - shawfdong/hyades GitHub Wiki
Apache Cassandra is a free and open-source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Interestingly, the network performance and troubleshooting tool, perfSONAR, uses Cassandra; although typically perfSONAR runs on a single server.
Let's check the status of the Cassandra cluster on one of our perfSONAR boxes[1]:
# nodetool status Failed to connect to '127.0.0.1:7199': Connection refusedso JMX (Java Management Extensions) remote connection was not enabled[2].
To enable JMX remote connection, uncomment the following lines in /etc/cassandra/default.conf/cassandra-env.sh:
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT" JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false" JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
Restart Cassandra:
# service cassandra restart
Then we were able to check the status of the Cassandra cluster:
# nodetool status Note: Ownership information does not include topology; for complete information, specify a keyspace Datacenter: datacenter1 ======================= Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Owns Host ID Token Rack UN 127.0.0.1 101.02 MB 100.0% d88de376-d087-4ac6-a8e2-2166ae0ad5bd -9047867919027360828 rack1
Unsurprisingly, there is only one node in the cluster.
We can use the Cassandra Query Language shell (cqlsh) to communicate with Cassandra[3]:
# cqlsh
Connected to Test Cluster at localhost:9160.
[cqlsh 4.1.1 | Cassandra 2.0.7 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
Use HELP for help.
cqlsh> desc keyspaces;
system system_traces esmond
cqlsh> use system;
cqlsh:system> desc tables;
IndexInfo hints range_xfers sstable_activity
NodeIdInfo local schema_columnfamilies
batchlog paxos schema_columns
compaction_history peer_events schema_keyspaces
compactions_in_progress peers schema_triggers
cqlsh:system> describe table local;
CREATE TABLE local (
key text,
bootstrapped text,
cluster_name text,
cql_version text,
data_center text,
gossip_generation int,
host_id uuid,
native_protocol_version text,
partitioner text,
rack text,
release_version text,
schema_version uuid,
thrift_version text,
tokens set<text>,
truncated_at map<uuid, blob>,
PRIMARY KEY (key)
) WITH
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='information about the local node' AND
dclocal_read_repair_chance=0.000000 AND
gc_grace_seconds=0 AND
index_interval=128 AND
read_repair_chance=0.000000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
default_time_to_live=0 AND
speculative_retry='99.0PERCENTILE' AND
memtable_flush_period_in_ms=3600000 AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'LZ4Compressor'};
cqlsh:system> select key,host_id from local;
key | host_id
-------+--------------------------------------
local | d88de376-d087-4ac6-a8e2-2166ae0ad5bd
(1 rows)