본문 바로가기

Big Data

Druid - Technology Overview

아파치 드루이드는 오픈소스 분산데이터 저장소이다.

드루이드의 핵심 디자인은 data warehoses, timeseries databases 그리고 search systems 가 결합된 것이다.

드루이드는 위 세가지 특징을 ingestion layer, storage format, querying layer 그리고 core architecture 로 결합해서 구현한다.

 

 

Key features of Druid include:

Column-oriented storage

Druid stores and compresses each column individually, and only needs to read the ones needed for a particular query, which supports fast scans, rankings, and groupBys.

Native search indexes

Druid creates inverted indexes for string values for fast search and filter.

Streaming and batch ingest

Out-of-the-box connectors for Apache Kafka, HDFS, AWS S3, stream processors, and more.

Flexible schemas

Druid gracefully handles evolving schemas and nested data.

Time-optimized partitioning

Druid intelligently partitions data based on time and time-based queries are significantly faster than traditional databases.

SQL support

In addition to its native JSON based language, Druid speaks SQL over either HTTP or JDBC.

Horizontal scalability

Druid has been used in production to ingest millions of events/sec, retain years of data, and provide sub-second queries.

Easy operation

Scale up or down by just adding or removing servers, and Druid automatically rebalances. Fault-tolerant architecture routes around server failures.

Integration

Druid 는 apache kafka, apache hadoop, apache flink 등 다른 apache 의 기술들과 상호보완적이다.

Druid 는 특히! end user 의 storage layer 와 processing layer 사이에 놓여져 있다.

그리고 데이터 분석을 수행할때는 query layer 로써 동작한다.

 

Ingestion

Druid 는 streaming 과 batch ingestion 을 모두 지원한다. Druid 는 전형적인 message bus 인 apache kafka 나 분산시스템인 HDFS 와 같은 원시데이터 소스에 접근한다.

Druid 는 원시 저장소에 저장되어있는 raw data 를 "indexing" 이라고 불리우는 과정을 통해서 read-optimized format 으로 변경한다. (이것을 드루이드에서는 "segment" 라고 부른다)

 

Storage

많은 분석용 데이터베이스와 마찬가지로 드루이드도 컬럼 형태로 데이터를 저장한다. 컬럼에 타입에 따라서 (string, number, etc) 다른 압축방식과 인코딩 방식이 적용된다. druid 는 또한 컬럼 타입에 따라서 다양한 인덱스를 구축한다.

검색시스템과 유사하게, druid 는 String column 에 대해서는 빠른 검색과 필터링 기능을 위해 역색인을 구축한다.

그리고 시계열 데이터베이스와 유사하게, 시간을 기반으로 데이터를 파티셔닝 한다.

많은 전통적인 시스템과는 다르게, druid 는 ingestion time 에 data 를 pre-aggregate 할 수 있다. 이 pre-aggregation 단계는 rollup 이라고 부르며, 이것을 잘 활용하면 드라마틱하게 저장소 비용을 절감할 수 있다.

 

Querying

Druid 는 http 를 통한 json type 의 api 를 지원하고, SQL 도 지원한다. 표준 SQL 연산자 뿐만 아니라, druid 는 빠른 counting, ranking 그리고 quantiles (분위수) 를 제공을 위한 근사알고리즘을 활용한 unique 한 연산들도 제공한다.

Architecture

Druid 는 microservice architecture 를 가지고 있어서 여러개의 분해된 데이터베이스로 생각할 수 있다.

druid 안의 각각의 core service 들 (ingestion, querying, coordination) 은 개별적으로 혹은 공동으로 하드웨어 위에 배포될 수 있다.

Druid는 운영자가 사용 사례 및 워크로드에 따라 각 서비스를 미세 조정할 수 있도록 모든 주요 서비스의 이름을 명시 적으로 지정합니다.

예를 들어, 운영자는 필요한경우 query service 에 더 적은 리소스를 할당하면서 ingestion service 에 더 많은 리소스를 할당할 수 있다.

 

Operations

druid 는 항상 데이터를 유지해야 하는 고가용성의 요구사항에 대비해 다음과 같은 몇가지 features 를 가지고 있다.

1. Data replication

Druid 안의 모든 데이터는 미리 설정한 숫자만큼 복제된다.

2. Independent services

드루이드 안에 모든 service 들은 각각 이름지어진며, 각각의 service 들의 fail 은 다른서비스들에게 영향을 주지 않는다. 예를 들어, 만약 ingestion system 이 fail 되어 더 이상 새로운 data 의 유입이 불가능하더라도, 남아있는 데이터에 대해서는 여전히 쿼리가 가능하다.

3. Automatic data backup

Druid 는 모든 indexed 된 data 들을 HDFS 와 같은 filesystem 에 자동으로 백업한다. 만약 전체 druid 클러스터가 날라갔다 하더라도 이 백업된 데이터들을 활용해서 빠르게 복원할 수 있다.

4. Rolling updates

rolling update 를 통해 druid 의 downtime 없이 업데이트가 가능하다. 모든 druid 의 release version 은 이전 버전과 호환된다.

'Big Data' 카테고리의 다른 글

[Druid][Tutorial] Writing an ingestion spec  (0) 2020.11.24
Druid - Design  (0) 2020.11.10
Druid - Use Cases  (0) 2020.10.19