Database Reference
In-Depth Information
Introduction to CQLSH
Now that we are through with the Cassandra setup, let's get acquainted with the shell and a
few basic commands:
1. Run CQL at /usr/local/Cassandra/apache-cassandra-1.1.6 using
bin/cqlsh with a host and port:
bin/cqlsh -host <ip-adress> -p <port number>
2. Create a keyspace either at the Cassandra client or at CQL, as follows:
create keyspace <keyspace_name>;
3. Create a column family at the Cassandra client or at CQL as follows:
use <keyspace_name>;
create column family <columnfamily name>;
For example, create the following table:
CREATE TABLE appUSers (
user_name varchar,
Dept varchar,
email varchar,
PRIMARY KEY (user_name));
4. Insert a few records into the column family from the command line:
INSERT INTO appUSers (user_name, Dept, email)
VALUES ('shilpi', 'bigdata,
'shilpisaxena@yahoo.com');
5. Retrieve the data from the column family:
SELECT * FROM appUSers LIMIT 10;
Search WWH ::




Custom Search