MySQL和 HBase 是当下比较流行的两个数据库,都能支持数据的增删改查,分别解决应用的在线事务问题和大数据场景的数据存储。本文内容介绍他们的技术、功能及场景差别,对于技术选型有一定的参考价值。

注脚

展开查看详情

1.02 5 - 1

2. NoSQL MapReduce (osdi04) BigTable (osdi06) GFS (sosp03) NoSQL Hadoop (2006 ) HBase (2009 ) Hadoop HDFS (2006 ) : Spark AMPLab 2010

3.

4. (DRDS) Shard1(000-100) Shard2(101-200) Leader … Follower Follower HA HA

5. HBase … HMaster HMaster RegionServer RegionServer RegionServer HBase Namenode Namenode Datanode … … ZKServer ZKServer ZKServer Datanode Datanode HDFS Zookeeper

6. MySQL HBase 1. ( ) 2. HDFS( ) 1. MySQL ( ) ( ) 2. HBase 6

7.

8.SQL + MySQL InnoDB (B+ Tree)

9. RegionServer ( ) HDFS( Disk) Regionserver Table (Region) Regionserver (LSM Tree)

10. MySQL HBase 1. HBase SQL ( SQL API) HBase (Lindorm) Phoenix SQL 2. HBase LSM(Log-Structure Merge) Innodb B+ • LSM • memory • IO B+ • IO IO IO • • • SSD • • • IO B+ • compaction / IO

11. HBase BulkLoad HFile (HBase ) HDFS HBase Regionserver HBase BulkLoad 1. API 2. HBase 3. ( ) HBase BulkLoad LSM + ( HDFS) (LSM) (HDFS) HBase BulkLoad (MapReduce Hadoop Spark )

12. (B+ Tree vs LSM Tree) 1. MySQL 2. HBase IO 12

13.

14. 20 10w MySQL SQL HBase API Phoenix SQL

15. TTL 1. 2. TTL Time To Live Metric Name Date Value TTL Cpu_user 2019-5-1 16:00:00 0.05 2019-6-1 16:00:00 Cpu_user 2019-5-1 16:10:00 0.1 2019-6-1 16:10:00 Load_one 2019-5-2 15:00:00 1.1 2019-6-2 15:00:00 Load_one 2019-5-3 16:00:00 1.3 2019-6-3 16:00:00 Load_one 2019-5-3 16:10:00 1.5 2019-6-3 16:10:00

16. (Dynamic Column) 1. 2. 3. 20 10w

17. (Multi Versions) 1. 2. 3. ID 1001 2019-5-9 16:00 2019-5-1 11:00 2019-4-9 12:00 … … 100 1001 ” ” ” ” 100 100 N

18. (Column Family) 1. 2. 3. 4. (Content) (Metadata) com.cnn.www <html …>…</html> 20480 2019-05-01 com.taobao.www <html… …. 147456 2019-05-09 Value 10KB+; ; /

19.MOB(Medium Object) 1. (100KB-10MB) PDF 2. HBase <100KB > 10MB 100KB~10MB HDFS 20 MOB ( MySQL+ ) MySQL+ HBase MOB NO Y MOB Y Y

20.

21.MySQL APP

22.MR Hive Spark Tephra Calcite Argus Open Flink Drill Kylin Phoenix Trafodion TSDB HBase HDFS Zookeeper

23.MySQL ( ) HBase

24. SQL Schema Free TTL 4 9 SLA B+ Tree LSM Tree

25.

26.

27. HBase l d . BulkLoad l r l l r s ( )H ( sS ) / l p HDD OSS l ka l r o r 1 l e ms 2 Spark Hadoop B r B r

28.

29. 1 2 1 s i 3 SB Sk 1 2 2 . / / g s 3 F s g S B Sk g r r 3 e HBase s e BulkLoadi l s r i l i a S m l ra ( ) p ( ) He o l t HDD OSS e l r l g r s r l g r a k l l ams k a Spark Hadoop ond