Introduction to CLI
This section gets you acquainted with another tool that is used for interaction with Cassandra processes—the CLI shell.
The following steps are used for interacting with Cassandra using the CLI shell:
The following is the command to connect to the Cassandra CLI:
Cd Cassandra-installation-dir/bin cassandra-cli -host localhost -port 9160
Create a keyspace:
[default@unknown] CREATE KEYSPACE myKeySpace with placement_strategy = 'SimpleStrategy' and strategy_options = {replication_factor:1};
Verify the creation of the keyspace using the following command:
[default@unknown] SHOW KEYSPACES; Durable Writes: true Options: [replication_factor:3] Column Families: ColumnFamily: MyEntries Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type Default column value validator: org.apache.cassandra.db.marshal.UTF8Type Columns sorted by: org.apache.cassandra.db.marshal.ReversedType (org.apache.cassandra.db.marshal.TimeUUIDType) GC grace seconds...