Cassandra3.9版本基础入门3-插入和查询

Cassandra的API是CQL(Cassandra Query Language),要使用CQL,需要先连接到集群。连接的方式:
(1)使用cqlsh;
(2)通过Cassandrad的客户端驱动程序。
注:使用CQLSH前请先安装Python 2.7和python-setuptools,并将cql模块装到python。详细操作请参考http://it.zhaozhao.info/archives/8057

CQLSH
cqlsh是用于让CQL和Cassandra进行交互的命令行脚本。每个Cassandra压缩包中都会自动提供,可以在bin目录下找到可执行文件。 它连接到在命令行上指定的单个节点。 例如:
$ bin/cqlsh localhost
Connected to Test Cluster at localhost:9042.
[cqlsh 5.0.1 | Cassandra 3.8 | CQL spec 3.4.2 | Native protocol v4]
Use HELP for help.
cqlsh> SELECT cluster_name, listen_address FROM system.local;

 cluster_name | listen_address
--------------+----------------
 Test Cluster |      127.0.0.1

(1 rows)
cqlsh>

关于CQL的使用会在之后专门详细的讲解,读者先做个稍微的了解

客户端驱动
许多客户端驱动程序由社区提供,以下提供已知驱动程序的列表。 您应参考每个驱动程序的文档以获取有关如何使用它们的更多信息。
Java
Python
Ruby
C# / .NET
Nodejs
PHP
C++
Scala
Clojure
Erlang
Go
Haskell
Rust
Data modeling example...................................................................................................................... 8 Example of a music service..................................................................................................... 8 Compound keys and clustering................................................................................................9 Collection columns..................................................................................................................10 Adding a collection to a table.................................................................................................10 Updating a collection.............................................................................................................. 10 Indexing a collection...............................................................................................................11 Filtering data in a collection................................................................................................... 12 When to use a collection........................................................................................................12 Indexing............................................................................................................................................. 12 When to use an index............................................................................................................13 Using an index........................................................................................................................13 Using multiple indexes............................................................................................................14 Building and maintaining indexes..................................................................................................... 14 Working with legacy applications...................................................................................................... 14 Using a CQL query
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值