- 一致性(Consistency) (所有節點在同一時間具有相同的數據)
- 可用性(Availability) (保證每個請求不管成功或者失敗都有響應)
- 分隔容忍(Partition tolerance) (系統中任意信息的丟失或失敗不會影響系統的繼續運作)
Denormalization, Duplication, and Intelligent Keys (DDI)
关于HBase URL Shortener示例的一些扩展阅读:
https://github.com/michiard/CLOUDS-LAB/tree/master/hbase-lab
The support for sparse, wide tables and column-oriented design often eliminates the need to normalize data and, in the process, the costly JOINoperations needed to aggregatethe data at query time. Use of intelligent keys gives you fine-grained control over how—and where—data is stored. Partial key lookups are possible, and when combined with compound keys, they have the same properties as leading, left-edge indexes. Designing the schemas properly enables you to grow the data from 10 entries to 10 million entries, while still retaining the same write and read performance.
稀疏 sparse,wide tables,是反范式的
bigtable: 丢弃传统的RDBMS的CRU特性,追求更高效适应水平分布扩展需求的支持数据段扫描及全表扫描的分布式数据库
HBASE元素:ROW,ROWKEY,COLUMN,COLUMN FAMILY,CELL
HBASE的自然排序:HBASE是以lexicographically排序的即词典式的排序,按字节码排序
HBASE是支持二级索引的!但BIG TABLE不支持。
HBASE的COLUMN FAMILY须预先定义并且最好不应经常变成,数量上也最好要少于10个,不要太多(思考:难道是因为是sparse,
wide,所以最好不要有太多空白列?),不过一个column
family你尽管可以拥有上百万的column,因为它们占用的是行而非列。Timestamp可由系统指定也可由用户指定。
Predicate deletion => Log-structured Merge-Tree/LSM
HFile是按column family存储的,即一个column family占用一个HFile,为了更容易in-memory store
HBASE和BIGTABLE的“正统”用法是WEB TABLE啊.. 专用于爬虫的,比如保存anchor, content等
HBASE中的REGION相当于自动分片(auto - sharding)
For HBase and modern hardware, the number would be more like 10 to 1,000
regions per server, but each between 1 GB and 2 GB in
size
RegionServer管理近千个regions,理论上每个row只存在于一个region(问,如果一个row超过了一个region,如何处理的?
我们是不是不应该设计这样的rowkey先?)
Single-row transaction:一行的数据是事务性原子性的,无跨行原子性
Map-Reduce可将HBASE数据转化为inputFormat和outputFormat
HFile有block,block又致使必须得有block index lookup,这个index保存在内存中(in-memory block index)
Zookeeper是Chubby for bigtable的对应物,
It offers filesystem-like access with
directories and files (called znodes) that distributed systems can use
to negotiate ownership, register services, or watch for updates. Every region
server creates its own ephemeral node in ZooKeeper, which the master, in turn,
uses to discover available servers. They are also used to track server
failures or network partitions.
master (HMaster) 会做
- Zookeeper
(问:Zookeeper和HMaster分别做什么?书中P26语焉不详)
- 负载均衡管理
- 监控和管理schema changes,
metadata operations,如表/列族的创建等
- Zookeeper仍然使用heartbeating机制
Region server
- 做region split (sharding)
- 做region管理
Client直接与regions交互读写数据,region server并不参与
这儿完全不懂(P27): 涉及到表扫描算法
Table scans run in linear time and row key lookups or mutations are performed in logarithmic order—or, in extreme cases, even constant order (using Bloom filters). Designing the schema in a way to completely avoid explicit locking, combined with row-level atomicity, gives you the ability to scale your system without any notable effect on read or write performance.
何谓read-modify-write? wiki
In
computer science, read–modify–write is a class of atomic operations such as
test-and-set, fetch-and-add, and compare-and-swap which both read a memory
location and write a new value into it simultaneously, either with a
completely new value or some function of the previous value. These operations
prevent race conditions in multi-threaded applications. Typically they are
used to implement mutexes or semaphores. These atomic operations are also
heavily used in non-blocking synchronization.
3.疑惑:
原文:http://www.cnblogs.com/syveen/p/3707938.html