Database Reference
In-Depth Information
2.
Next, we will create a keyspace twitter and table twitterdata :
create keyspace twitter with
replication={'class':'SimpleStrategy','replication_factor':2};
use twitter;
create table twitterdata(tweetdate
varchar(50),screen_name varchar(50),body
varchar(300), id int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id));
3.
Let's load tweets data in the twitterdata table (see Figure 6-22 ):
LOAD DATA LOCAL INFILE '/home/vivek/tweets'
INTO TABLE twitterdata FIELDS TERMINATED BY
0x01 LINES TERMINATED BY '\n';
Figure 6-22 . Loading the file from the local file system in the hive table
4.
Next, start DSE Cassandra with Hadoop:
bin/dse cassandra -t
5.
After this, run sqoop import as follows:
bin/dse sqoop import --connect
jdbc:mysql://localhost/twitter --username
root -P --table twitterdata
--cassandra-keyspace twitter
--cassandra-column-family twitterdata
--cassandra-row-key id
--cassandra-thrift-host localhost
-cassandra-create-schema
6.
After successfully importing, let's explore the twitterdata
column family via cassandra-cli (see Figure 6-23 ) :
$DSE_HOME/bin/cassandra-cli
 
 
 
Search WWH ::




Custom Search