Change replication factor for an existing keyspace
ALTER KEYSPACE acme WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };
Drop a keyspace
DROP KEYSPACE acme;
Drop a column
ALTER TABLE person DROP mail;
Add a column
ALTER TABLE person ADD email text;
Counting keys (rows) in column. Here is a quick way to get an “estimated” count
nodetool cfstats acme.person
Command to check cluster / node status
nodetool status
Force restart of datastax agent
service datastax-agent force-reload
How to insert current date-time into a table using CQL?
This can be done using the now and dateof functions.
The now function takes no arguments and generates a new unique timeuuid (at the time where the statement using it is executed).
The dateof function takes a timeuuid argument and extracts the embedded timestamp.
INSERT INTO account (name, created) VALUES ('acme', dateof(now()));