Database Reference
In-Depth Information
1.
Assuming all three nodes are up and running (see the output shown in
the preceding section), let's create a keyspace twitter_keyspace and
table twitter using the cql command-line interface:
cqlsh> create keyspace twitter_keyspace with
replication = {'class':'SimpleStrategy',
'replication_factor':3};
cqlsh> use twitter_keyspace;
cqlsh:twitter_keyspace> create table
twitter(tweeted_at text, screen_name text,
body text, PRIMARY KEY
(tweeted_at,screen_name));
2.
Let's load data in the twitter table using the copy command:
cqlsh:twitter_keyspace> copy
twitter(tweeted_at,screen_name,body) from
'/home/vivek/tweets_pipe' WITH DELIMITER =
'|';
10020 rows imported in 12.457 seconds.
Here /home/vivek/tweets_pipe is a local file in which all
column values have a “|” field separator. You can find this file with
downloads for this topic, or you can create the sample using the fol-
lowing data and format:
2014-08-02|mevivs|Working on Cassandra book
2014-08-04|chris_nelson|Cassandra book review
in progress
Now let's try to decommission the node with the IP address
127.0.0.1 using the nodetool utility's decommission command:
vivek@vivek-Vostro-3560:~/software/
local-cluster/node1$ bin/nodetool decommission
Please note that we can only decommission a live node. Decom-
missioning a node would implicitly start data streaming to another
Search WWH ::




Custom Search