NOSQL数据库大比拼:Cassandra vs MongoDB vs CouchDB vs Redis vs Riak vs HBase

Cassandra vs MongoDB vs CouchDB vs Redis vs Riak vs HBase comparison :: KKovacs

CouchDB

Written in: Erlang
关键点Main point: DB consistency一致性, ease of use易用
License: Apache
Protocol: HTTP/REST
Bi-directional (!) replication, 双向复制
continuous or ad-hoc,
with conflict detection,冲突检测
thus, master-master replication. (!)主主复制
MVCC - write operations do not block reads 写操作不会阻塞读操作
Previous versions of documents are available文本式
Crash-only (reliable) design 可靠性设计
Needs compacting from time to time
Views: embedded map/reduce 内部嵌入Hadoop之类map/reduce算法
Formatting views: lists & shows
Server-side document validation possible
Authentication possible
Real-time updates via _changes (!)实时更新
Attachment handling
thus, CouchApps (standalone js apps)
jQuery library included

适合: 累计 堆积计算, 偶尔改变数据, 预先定义的查询. 非常注重版本控制的场合.
举例:: CRM, CMS系统. 主-主复制是其特别亮点,可以易于多个站点部署。


Redis

Written in: C/C++
关键点Main point:超快Blazing fast
License: BSD
Protocol: Telnet-like
Disk-backed in-memory database, 磁盘后备,内存数据库。
but since 2.0, it can swap to disk.但是从2.0开始直接交换到磁盘。
Master-slave replication主-从复制
Simple keys and values,简单的key-value形式
but complex operations like ZREVRANGEBYSCORE但是复杂操作类似ZREVRANGEBYSCORE
INCR & co (good for rate limiting or statistics)
Has sets (also union/diff/inter)
Has lists (also a queue; blocking pop)
Has hashes (objects of multiple fields)
Of all these databases, only Redis does transactions (!)在这些数据库中,只有Redis有事务机制。
Values can be set to expire (as in a cache)如同缓存一样,值能被设置为超过一定时间过期失效。
Sorted sets (high score table, good for range queries)有排序的sets,善于range查询。
Pub/Sub and WATCH on data changes (!)采取Pub/Sub 和观察者WATCH事件触发数据变化。

适合: 在可以控制的数据库大小情况下(放得下整个内存),快速改变数据,快速写数据。
案例:股票价格系统 分析,实时数据收集,联系等等。


[该贴被banq于2011-01-07 11:31修改过]

MongoDB

Written in: C++
关键点: 保留类似SQL风格. (Query, index)
License: AGPL (Drivers: Apache)
Protocol: Custom, binary (BSON)
Master/slave replication主从复制(分布式状态集群方式)
Queries are javascript expressions查询是javascript表达式
Run arbitrary javascript functions server-side
Better update-in-place than CouchDB比CouchDB更好地就地更新
Sharding built-in 内置分片碎片
Uses memory mapped files for data storage 使用内存对应文件方式实现数据存储
Performance over features
After crash, it needs to repair tables 当崩溃后,需要修复表。

适合: 需要动态查询. 愿意事先定义索引indexes, 不需要 map/reduce 功能. 你需要巨大的数据库有良好性能,你需要CouchDB但是你数据变化改变很频繁,需要频繁写。

案例:适合所有MySQL 或者 PostgreSQL场合,它也适合

Cassandra

Written in: Java
关键点: 大表模型BigTable 和 Dynamo中最好的
License: Apache
Protocol: Custom, binary (Thrift)
Tunable trade-offs for distribution and replication (N, R, W)
Querying by column, range of keys 按列查询
BigTable-like features: columns, column families 列
Writes are much faster than reads (!)写快于读
Map/reduce possible with Apache Hadoop
部分复杂性可能由于Java自身原因(如配置configuration, seeing exceptions, etc)

适合: 当写操作多于读操作 (如日子logging).
案例:: 银行Banking, 金融系统,写必须快于都的场合,实时的数据分析等.

Riak

Written in: Erlang & C, some Javascript
关键点: 容错性Fault tolerance 失败恢复 可靠性好
License: Apache
Protocol: HTTP/REST
Tunable trade-offs for distribution and replication (N, R, W)
Pre- and post-commit hooks,
for validation and security.
Built-in full-text search 内置全文本搜索
Map/reduce in javascript or Erlang Map/reduce支持
Comes in "open source" and "enterprise" editions 有两个版本

适合: 如果你希望有类似Cassandra-like (Dynamo-like)风格, 但是你不想处理器复杂性和膨胀性。单服务器有良好可伸缩性scalability, 可用性availability 和容错性 fault-tolerance, 采取是昂贵的多站点复制multi-site replication.

案例:销售点数据收集,工厂控制系统,那些不能允许几秒当机的场合。


HBase

Written in: Java
关键点: 十亿级别的行 X 百万级别的列 大容量
License: Apache
Protocol: HTTP/REST (also Thrift)
Modeled after BigTable大表模型
Map/reduce with Hadoop 内置Map/reduce
能够实时获得基于查询的优化
A high performance Thrift gateway 高性能的节约型网关
HTTP supports XML, Protobuf, and binary
Cascading, hive, and pig source and sink modules
Jruby-based (JIRB) shell
No single point of failure 无单点风险
Rolling restart for configuration changes and minor upgrades
Random access performance is like MySQL 随机访问的性能类似MySQL

适合: 如果你喜欢大表模型BigTable. :) 你需要随机 实时的读写操作

案例:: Facebook 消息数据库

A high performance Thrift gateway 高性能的节约型网关 ???

亲爱的bang大哥,我在你的论坛注册了N多年,没有说过几句话,但是看你这样非常不踏实的做法,我感到你这样做太不厚道了。

Thrift 是节约的意思没有错,但是Apache的 Thrift 又是什么?
这里说的Thrift 又是什么?
为什么Apache的这个项目叫做Thrift(节约),为什么起这样的名字让人顾名思义?
为什么将Thrift 可以作为HBase和Cassandra的入口?
为什么 Evernote的API也采用 Thrift ?

参考这里:http://www.evernote.com/about/developer/api/evernote-api.htm

网站的流程就是金钱,可是一知半解就不要硬撑,不懂就是不懂,不必为了人气和流量刻意装懂,你觉得喃?写出来的东西自己要有一定深刻的理解,免得造成不必要的误会。

出言不逊,多多包涵,新年快乐。



[该贴被amyno1于2011-01-31 16:05修改过]