大数据之Druid-IO介绍

一、Druid介绍

Druid是一个为大型冷数据集上实时探索查询而设计的开源数据分析和存储系统,提供极具成本效益并且永远在线的实时数据摄取和任意数据处理。Druid 是一个开源的,分布式的,列存储的,适用于实时数据分析的存储系统,能够快速聚合、灵活过滤、毫秒级查询、和低延迟数据导入。

Key Features

  • Designed for Analytics - Druid is built for exploratory analytics for OLAP workflows. It supports a variety of filters, aggregators and query types and provides a framework for plugging in new functionality. Users have leveraged Druid’s infrastructure to develop features such as top K queries and histograms.
  • Interactive Queries - Druid’s low-latency data ingestion architecture allows events to be queried milliseconds after they are created. Druid’s query latency is optimized by reading and scanning only exactly what is needed. Aggregate and filter on data without sitting around waiting for results.
  • Highly Available - Druid is used to back SaaS implementations that need to be up all the time. Your data is still available and queryable during system updates. Scale up or down without data loss.
  • Scalable - Existing Druid deployments handle billions of events and terabytes of data per day. Druid is designed to be petabyte scale.

Why Druid?

Druid was originally created to resolve query latency issues seen with trying to use Hadoop to power an interactive service. It's especially useful if you are summarizing your data sets and then querying the summarizations. Put your summarizations into Druid and get quick queryability out of a system that you can be confident will scale up as your data volumes increase. Deployments have scaled up to 2TB of data per hour at peak ingested and aggregated in real-time.

Druid is a system that you can set up in your organization next to Hadoop. It provides the ability to access your data in an interactive slice-and-dice fashion. It trades off some query flexibility and takes over the storage format in order to provide the speed.

We have more details about the general design of the system and why you might want to use it in our White Paper or in our Design doc.

When Druid?

  • You need to do interactive, fast, exploration on large amounts of data
  • You need analytics (not a key-value store)
  • You have a lot of data (10s of billions of events added per day, 10s of TB of data added per day)
  • You want to do your analysis on data as it’s happening (in real-time)
  • You need a data store that is always available, 24x7x365, and years into the future.

Not Druid?

  • The amount of data you have can easily be handled by MySQL
  • You're querying for individual entries or doing lookups (not analytics)
  • Batch ingestion is good enough
  • Canned queries are good enough
  • Downtime is no big deal

二、Druid主要特性:

为分析而设计——Druid是为OLAP工作流的探索性分析而构建。它支持各种filter、aggregator和查询类型,并为添加新功能提供了一个框架。用户已经利用Druid的基础设施开发了高级K查询和直方图功能。

交互式查询——Druid的低延迟数据摄取架构允许事件在它们创建后毫秒内查询,因为Druid的查询延时通过只读取和扫描有必要的元素被优化。Aggregate和 filter没有坐等结果。

高可用性——Druid是用来支持需要一直在线的SaaS的实现。你的数据在系统更新时依然可用、可查询。规模的扩大和缩小不会造成数据丢失。

可伸缩——现有的Druid部署每天处理数十亿事件和TB级数据。Druid被设计成PB级别。

就系统而言,Druid功能位于PowerDrill和Dremel之间。它实现几乎所有Dremel提供的工具(Dremel处理任意嵌套数据结构,而Druid只允许一个基于数组的嵌套级别)并且从PowerDrill吸收一些有趣的数据格式和压缩方法。

三、什么情况下需要Druid?

当你需要在大数据集上面进行快速的,交互式的查询时

当你需要进行数据分析,而不只是简单的键值对存储时

当你拥有大量的数据时 (每天新增数百亿的记录、每天新增数十TB的数据)

当你想要分析实时产生的数据时

当你需要一个24x7x365无时无刻不可用的数据存储时

四、什么情况下不需要用Druid?

当数据量可以在MySQL中很轻松的处理时

当你在查询某一天具体的记录而不是做分析时

当批量数据集成对你来说已经足够好的情况下

当你只需要执行固定的查询时

当系统偶尔down也没什么大不了的时候



 

五、Druid五类节点

Druid 本身包含了五种节点 : Realtime、Historical、Coordinator、Broker、Indexer

Overlord Node (Indexing Service)

Overlord会形成一个加载批处理和实时数据到系统中的集群,同时会对存储在系统中的数据变更(也称为索引服务)做出响应。另外,还包含了Middle Manager和Peons,一个Peon负责执行单个task,而Middle Manager负责管理这些Peons。

Coordinator Node

监控Historical节点组,以确保数据可用、可复制,并且在一般的“最佳”配置。它们通过从MySQL读取数据段的元数据信息,来决定哪些数据段应该在集群中被加载,使用Zookeeper来确定哪个Historical节点存在,并且创建Zookeeper条目告诉Historical节点加载和删除新数据段。

Historical Node

是对“historical”数据(非实时)进行处理存储和查询的地方。Historical节点响应从Broker节点发来的查询,并将结果返回给broker节点。它们在Zookeeper的管理下提供服务,并使用Zookeeper监视信号加载或删除新数据段。

Broker Node

接收来自外部客户端的查询,并将这些查询转发到Realtime和Historical节点。当Broker节点收到结果,它们将合并这些结果并将它们返回给调用者。由于了解拓扑,Broker节点使用Zookeeper来确定哪些Realtime和Historical节点的存在。

Real-time Node

实时摄取数据,它们负责监听输入数据流并让其在内部的Druid系统立即获取,Realtime节点同样只响应broker节点的查询请求,返回查询结果到broker节点。旧数据会被从Realtime节点转存至Historical节点。

Druid 包含3个外部依赖 :Mysql、Deep storage、Zookeeper

Mysql:存储关于Druid中的metadata而不是存储实际数据,包含3张表:”druid_config”(通常是空的), “druid_rules”(协作节点使用的一些规则信息,比如哪个segment从哪个node去load)和“druid_segments”(存储每个segment的metadata信息);

Deep storage: 存储segments,Druid目前已经支持本地磁盘,NFS挂载磁盘,HDFS,S3等。Deep Storage的数据有2个来源,一个是批数据摄入, 另一个来自实时节点;

ZooKeeper: 被Druid用于管理当前cluster的状态,比如记录哪些segments从实时节点移到了历史节点;

猜你喜欢

转载自gaojingsong.iteye.com/blog/2338709
今日推荐