cassandra command lines

1. create keyspace

>>create keyspace packt
with replication = 
{'class':'SimpleStrategy','replication_factor':1}

2. create table

>>use packt;
>>create table stock_ticker_by_exchange_date { exchange varchar, symbol varchar, description varchar, tick_date varchar, close decimal, primary key ((exchange,tick_date), symbol) }

exchange, tick_date 两个字段作为row key / partition key;

exchange, tick_date, symbol 3个字段作为(compound)primary key,复合主键,称之为wide row;单列主键,称之为skinny row。

默认primary key第一个字段作为row key。

3. cassandra特有的支持集合数据类型

在一个字段中存放小量的数据集,支持set,list,map格式。

4. 创建二级索引

create index dayquote06_sector_idx on dayqoute06(sector)

5. load SSTable

sstableloader -d ubtc01 packtcdma/qutoe

6. nodetool

#cluster status
nodetool status
nodetool netstats
nodetool info
nodetool tpstats
nodetool cfstats

#take snapshot
nodetool snapshot packtcdma

nodetool tablestats #keyspace#.#table#

 7. tables

describe tables;
describe #table_name#

 

posted @ 2016-11-20 23:03  RogerIs谭纶  阅读(199)  评论(0编辑  收藏  举报