Starting with Apache
Cassandra Command Line Interface
Command Line Interface (CLI) can be used to interact with
Apache Cassandra server and execute the some execution that be done by using
Client code.
Now, I’ll
walk you thru some basic operations with Apache Cassandra Command Line
Interface (CLI).
Step 1:
Start the Apache Cassandra Server by running
<Cassandra_home>\bin\Cassandra.bat file.
Step 2:
Start the Command Line Interface from
<Cassandra_home>\bin\cassandra-cli.bat
file.
Step 3:
Connect you Cassandra CLI with Cassandra Server.
Command: connect localhost/9160;
Step 4:
Displaying existing Keyspaces.
Command : show keyspaces;
Description:
It will display all the existing keyspaces in the connected Cassandra server.
Step 5:
Creating new keyspace;
Command :
Create keyspace <keyspacename>;
Ex:
create keyspace MuraliKeySpace;
Step 6:
Use existing keyspace;
Command :
use <keyspacename>;
Ex: use
MuraliKeySpace;
Once you
connected to any keyspace, the default@unknown will be changed to
default@<KeySpaceName>.
Now, it is changed to default@MuraliKeySpace.
Step 7:
Creating column family.
Command: create column family
<ColumnFamilyName>;
Ex: create
column family users;
No comments:
Post a Comment