Connection:
$ ./cqlsh -3 node3 9160 -u admin -p admin
Connected to SSCluster at node3:9160.
[cqlsh 2.3.0 | Cassandra 1.2.10 | CQL spec 3.0.0 | Thrift protocol 19.36.0]
Use HELP for help.
cqlsh>
Create Keyspace:
cqlsh> CREATE KEYSPACE ks215 WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 3};
Use Keyspace:
cqlsh> use ks215;
Alter Keyspace
cqlsh:ks215> ALTER KEYSPACE ks215 WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 2};
Create Table (Column Family)
cqlsh:ks215> CREATE TABLE company ( empID int, nationalID int, first_name varchar, last_name varchar, possition varchar, PRIMARY KEY (empID, nationalID));
Insert into table:
cqlsh:ks215> INSERT INTO company (empID, nationalID, first_name, last_name, possition) VALUES (101, 900810543, 'Chamara', 'Ariyarathne', 'SSE');
Select:
cqlsh:ks215> SELECT * FROM company;