Cassandra学习笔记

CASSANDRA在工作中用过,但是用的项目少,能用却了解的不全面。今天来稍加学习下:

http://zqhxuyuan.github.io/2015/10/15/Cassandra-Daily/ 

Step1:  首先,CASSANDRA也是Apache的产品,是个DB。官网原话: The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance. Linear scalability and proven fault-tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data.Cassandra's support for replicating across multiple datacenters is best-in-class, providing lower latency for your users and the peace of mind of knowing that you can survive regional outages.

Cassandra 是一个来自 Apache 的分布式数据库,具有高度可扩展性,可用于管理大量的结构化数据。它提供了高可用性,没有单点故障。

这是一种NoSQL类型的数据库。

具体语法使用过程

cqlsh IP Port 连接到某个数据库
select * from system.schema_keyspaces; ---查看系统中所有的数据库
cqlsh> desc keyspaces; --keyspaces类似于SQLserver中的数据库概念

cep_uat_new coach_qa janssen_uat system_traces
system cep_sit_new coach_dev coach_uat


use coach_uat; ----声明使用哪一个数据库

cqlsh:coach_uat> desc tables;-----展示该数据库下的表

tablename1 tablename11 tablename33
tablename2

desc table tablename; ----展示具体一张表的字段属性

查询前两行

select * from tablename limit 2;  --注意CASSANDRA默认显示10000行,如果希望显示更多的行,可将limit的值设置为大于10000即可。

删除语句

delete from tablename where uid =‘’ ;

创建一张新表 

CREATE TABLE test2222 (
uid text,
address text,
PRIMARY KEY (uid)
);

删除一张表

drop table test2222; 

查询Cassandra DB的版本

select release_version from System.local

原文地址:https://www.cnblogs.com/qianjinyan/p/9075384.html