apache/cassandra
摘要
Apache Cassandra 是一个高度可扩展的分区行存储数据库,通过其 Cassandra 查询语言(CQL)自动在机器间分布数据。
查看缓存全文
缓存时间: 2026/07/27 13:40
apache/cassandra
来源:https://github.com/apache/cassandra
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[许可证, link=https://github.com/apache/cassandra/blob/trunk/LICENSE.txt]
image:https://ci-cassandra.apache.org/job/Cassandra-trunk/badge/icon[构建状态, link=https://ci-cassandra.apache.org/job/Cassandra-trunk/]
image:https://img.shields.io/badge/Official-Downloads-brightgreen[官方下载, link=https://cassandra.apache.org/_/download.html]
image:https://img.shields.io/docker/pulls/_/cassandra[Docker拉取, link=https://hub.docker.com/r/_/cassandra]
image:https://img.shields.io/badge/Slack-4A154B?style=flat&logo=slack&logoColor=white[Slack, link=https://infra.apache.org/slack.html]
image:https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff&color=0285FF[Bluesky, link=https://bsky.app/profile/cassandra.apache.org]
image:https://img.shields.io/badge/-LinkedIn-blue?style=flat-square&logo=Linkedin&logoColor=white&link=https://www.linkedin.com/company/apache-cassandra/[LinkedIn, link=https://www.linkedin.com/company/apache-cassandra/]
image:https://img.shields.io/badge/YouTube-FF0000?style=flat&logo=youtube&logoColor=white[Youtube, link=https://www.youtube.com/c/PlanetCassandra]
Apache Cassandra
Apache Cassandra 是一个高度可扩展的分区行存储。行按表组织,每张表需要指定主键。
https://cwiki.apache.org/confluence/display/CASSANDRA2/Partitioners[分区] 意味着 Cassandra 可以以对应用透明的方式将数据分布到多台机器上。当集群中添加或移除机器时,Cassandra 会自动进行重新分区。
https://cwiki.apache.org/confluence/display/CASSANDRA2/DataModel[行存储] 意味着与关系型数据库类似,Cassandra 按行和列组织数据。Cassandra 查询语言(CQL)与 SQL 密切相关。
更多信息,请访问 https://cassandra.apache.org/[Apache Cassandra 网站]。
问题请报告到 https://issues.apache.org/jira/projects/CASSANDRA/issues/[Cassandra Jira]。
要求
- Java:支持的版本见 build.xml(搜索属性 “java.supported”)。
- Python:
cqlsh所需的 Python 版本见bin/cqlsh(搜索函数 “is_supported_version”)。
快速入门
本简短指南将引导您启动一个基本的单节点集群,并演示简单的读写操作。更完整的指南,请参阅 Apache Cassandra 网站上的 https://cassandra.apache.org/doc/latest/cassandra/getting-started/index.html[入门指南]。
首先,解压我们的归档文件:
$ tar -zxvf apache-cassandra-$VERSION.tar.gz $ cd apache-cassandra-$VERSION
然后启动服务器。使用 -f 参数运行启动脚本会让 Cassandra 保持在前台运行,并将日志输出到标准输出;可以通过 Ctrl-C 停止。
$ bin/cassandra -f
现在,让我们尝试使用 Cassandra 查询语言读写一些数据:
$ bin/cqlsh
命令行客户端是交互式的,如果一切正常,您应该会看到提示符:
Connected to Test Cluster at localhost:9160. [cqlsh 6.3.0 | Cassandra 7.0-SNAPSHOT | CQL spec 3.4.8 | Native protocol v5] Use HELP for help. cqlsh>
如欢迎信息所示,您可以使用 ‘help;’ 或 ‘?’ 查看 CQL 支持的功能,当您玩够了,可以使用 ‘quit;’ 或 ‘exit;’ 退出。但让我们尝试一些更有趣的操作:
cqlsh> CREATE KEYSPACE schema1 WITH replication = { ‘class’ : ‘SimpleStrategy’, ‘replication_factor’ : 1 }; cqlsh> USE schema1; cqlsh:Schema1> CREATE TABLE users ( user_id varchar PRIMARY KEY, first varchar, last varchar, age int ); cqlsh:Schema1> INSERT INTO users (user_id, first, last, age) VALUES (‘jsmith’, ‘John’, ‘Smith’, 42); cqlsh:Schema1> SELECT * FROM users; user_id | age | first | last ———+—–+—––+—–– jsmith | 42 | john | smith cqlsh:Schema1>
如果您的会话与上面类似,恭喜,您的单节点集群已成功运行!
有关 CQL 支持的更多命令,请参阅 https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/index.html[CQL 参考]。一个合理的理解方式是:“SQL 减去连接和子查询,加上集合”。
想知道接下来该做什么?
- 加入我们在 https://s.apache.org/slack-invite[ASF Slack] 上的 #cassandra 频道并提问。
- 发送邮件至 [email protected] 订阅用户邮件列表。
- 发送邮件至 [email protected] 订阅开发者邮件列表。
- 访问 Cassandra 网站的 https://cassandra.apache.org/community/[社区部分] 获取更多参与信息。
- 访问 Cassandra 网站的 https://cassandra.apache.org/doc/latest/development/index.html[开发部分] 获取更多贡献信息。
相似文章
@jhleath: https://x.com/jhleath/status/2065408690992148698
作者解释了如何构建一个能够在恒定时间内每秒启动数百万个沙箱的计算平台,重点介绍了使用Cassandra和S3进行解耦调度和能力聚合。
apache/ossie
Apache Ossie 是一个孵化中的开源规范,它标准化了数据分析、AI 和 BI 工具之间的语义模型交换,提供了供应商无关的 JSON/YAML 格式,以确保数据定义的一致性。
elastic/elasticsearch
Elasticsearch 是一个分布式搜索和分析引擎,也是一个可扩展的数据存储和向量数据库,针对速度和相关性进行了优化。它为搜索和AI应用提供支持,包括RAG和向量搜索。
CQL:范畴数据库
CQL是一个开源工具,利用范畴论执行数据库操作,如查询、迁移和集成数据,并通过定理证明提供内置的正确性保证。
@AravSrinivas: 我们构建了一个AWS DynamoDB的替代品,这是一个用于快速网页内容抓取的键值数据库。这由两名工程师完成……
Perplexity宣布了CobbleDB,这是一个作为AWS DynamoDB替代品构建的键值数据库,使用了两名工程师和数百个AI代理,潜在年节省达1亿美元。