체크 record 선정


SELECT * FROM "sejong_bike"
WHERE bike_id LIKE 'SJ-0001' 
     AND user_id='junecy'
ORDER BY __time
LIMIT 1

 

 

#1 .csv 파일을 직접 vi로 수정하여 druid에 반영이 되었는지 확인 


 

$ vi data_fn.csv

# 1번 record station_rental_id = 0101로 변경

 

반영 안되는 것 확인

 

 

 

#2. druid에 record ingestion 후 druid에 반영이 되었는지 확인


Updating existing data

 

 

This spec creates a datasource called updates-tutorial from the quickstart/tutorial/updates-data.json input file.

{
  "type" : "index_parallel",
  "spec" : {
    "dataSchema" : {
      "dataSource" : "updates-tutorial",
      "timestampSpec": {
        "column": "timestamp",
        "format": "iso"
      },
      "dimensionsSpec" : {
        "dimensions" : [
          "animal"
        ]
      },
      "metricsSpec" : [
        { "type" : "count", "name" : "count" },
        { "type" : "longSum", "name" : "number", "fieldName" : "number" }
      ],
      "granularitySpec" : {
        "type" : "uniform",
        "segmentGranularity" : "week",
        "queryGranularity" : "minute",
        "intervals" : ["2018-01-01/2018-01-03"],
        "rollup" : true
      }
    },
    "ioConfig" : {
      "type" : "index_parallel",
      "inputSource" : {
        "type" : "local",
        "baseDir" : "quickstart/tutorial",
        "filter" : "updates-data2.json"
      },
      "inputFormat" : {
        "type" : "json"
      },
      "appendToExisting" : false
    },
    "tuningConfig" : {
      "type" : "index_parallel",
      "maxRowsPerSegment" : 5000000,
      "maxRowsInMemory" : 25000
    }
  }
}

 

bin/post-index-task --file quickstart/tutorial/updates-init-index.json --url http://localhost:8081

 

druid console에서 확인

 

'Database > Druid' 카테고리의 다른 글

Druid Quickstart  (0) 2020.08.21
How to install Druid 0.19.0 on Cent OS 8  (0) 2020.08.21
CentOS 8 에서 Druid Console 외부접속하기  (0) 2020.08.05
How to install Druid 0.13.0 on CentOS 8  (0) 2020.07.31
[MacOS] Druid 설치  (0) 2020.07.23

1. local disk와 연결

Base directory : quickstart/tutorial/
file filter : wikiticker-2015-09-12-sampled.json.gz

 

입력 후 데이터 확인하고 [Next: Parse data] 클릭

 

 

 

2. parse data 확인

 

input format은 json

[Next: Parse time] 클릭

 

 

 

3. parse time 확인

 

확인 후 configure schema까지 skip

 

 

 

4. configure schema에서 rollup 세팅

 

 

 

5. segment granularity 'day' 로 설정

 

[Next: Tune] -> [Next: Publish] 클릭

 

 

 

6. spec 확인 

 

 

[Submit] 클릭

 

 

data ingestion이 Running -> Success로 변하면 상단 메뉴바의 [datasources] -> 오른쪽 랜치모양 아이콘 클릭

 

 

 

7. [query with SQL] -> 쿼리문 작성 -> [run]

 

 

아래에서 쿼리에 대한 결과를 확인할 수 있다

 

 

 

 

# 파일 다운로드
$ wget [http://mirror.navercorp.com/apache/druid/0.19.0/apache-druid-0.19.0-bin.tar.gz](http://mirror.navercorp.com/apache/druid/0.19.0/apache-druid-0.19.0-bin.tar.gz)

# 압축 해제
$ tar -xzf apache-druid-0.19.0-bin.tar.gz
$ cd apache-druid-0.19.0

# druid 실행 (druid 폴더에서 명령어 실행)
$ ./bin/start-micro-quickstart

 

 

참고


https://druid.apache.org/docs/latest/operations/single-server.html#nano-quickstart-1-cpu-4gb-ram

 

Single server deployment · Apache Druid

 

'Database > Druid' 카테고리의 다른 글

Druid quickstart - Updating existing data  (0) 2020.08.28
Druid Quickstart  (0) 2020.08.21
CentOS 8 에서 Druid Console 외부접속하기  (0) 2020.08.05
How to install Druid 0.13.0 on CentOS 8  (0) 2020.07.31
[MacOS] Druid 설치  (0) 2020.07.23

Druid와 Superset 연결


  • From the UI, enter the information about your clusters in the Sources -> Druid Clusters menu by hitting the + sign.
  • Once the Druid cluster connection information is entered, hit the Sources -> Refresh Druid Metadata menu item to populate
  • Navigate to your datasources

 

  • pydruid 설치
# superset에서 druid 사용하려면 설치 필수!
$ pip install pydruid

 

 

  • sources -> database -> +new 버튼 클릭

 

 

  • SQLAlchemy URI에  druid://XX.XX:8082/druid/v2/sql/
druid://<ip address>:8888/druid/v2/sql/

 

 

  • Allow Csv Upload, Allow CREATE TABLE AS, Allow DML 체크박스

 

 

  • Extra 옵션에서 아래와 같이 AUTOCOMMIT을 설정 => DB 작업 바로 반영 (에러발생)
"engine_params": {"isolation_level":"AUTOCOMMIT"},

 

 

  • Backend에  druid 확인 -> 연결 완료

 

 

 

 

Superset에서 Druid database SQL문 실행해보기


SQL Lab 클릭 -> SQL Editor 클릭 -> 원하는 쿼리문 작성

 

 

 

참고


https://docs.ncloud.com/ko/das/das-1-2.html

 

설명서

Superset 시작하기 패키지를 만든 후 최초 1회는 Superset 서버에 접속해서 제공된 스크립트를 실행하여 Superset 관리자 계정과 필요한 테이블과 대시보드 등을 생성하고 필요한 초기 설정 작업을 수��

docs.ncloud.com

 

'Database > Superset' 카테고리의 다른 글

How to install Superset on CentOS 8 (linux)  (0) 2020.08.10

Superset 설치


pip3를 사용하여 superset을 설치해야 하므로 이전 포스팅의 pip3 업데이트를 진행 후 시작~!

2020/08/10 - [linux] - Linux python path설정 & pip3 업데이트

 

# Install superset
$ sudo pip install apache-superset

# Initialize the database
superset db upgrade

 

 

Admin user 생성


# Create an admin user (you will be prompted to set a username, first and last name before setting a password)
$ export FLASK_APP=superset

# admin user 생성
$ superset fab create-admin

 

 

load 데이터


# Load some data to play with
$ superset load_examples

# Create default roles and permissions
$ superset init

 

 

 

웹으로 확인하기


# To start a development web server on port 8088, use -p to bind to another port
$ superset run -p 8088 --with-threads --reload --debugger

 

만약, 서버에 붙어서 개발 중이라면 모든 ip 허용시키고 접근 (보안문제로 내부에서 테스트 할 때만 사용 권장)

$ superset run -h 0.0.0.0 -p 8088 --reload --debugger --with-threads

 

 

web화면

 

create admin에서 설정한 username과 password 사용

 

 

load 데이터로 시각화


 

 

참고


https://superset.apache.org/installation.html#superset-installation-and-initialization

 

Installation & Configuration — Apache Superset documentation

Getting Started Superset has deprecated support for Python 2.* and supports only ~=3.6 to take advantage of the newer Python features and reduce the burden of supporting previous versions. We run our test suite against 3.6, but 3.7 is fully supported as we

superset.apache.org

 

'Database > Superset' 카테고리의 다른 글

Superset에서 Druid database 사용하기  (1) 2020.08.10

druid.host 변경


 

$ vim conf/druid/single-server/nano-quickstart/_common/common.runtime.properties

 

 

 

 

<ip address>:8888 접속 에러페이지가 안뜨는 오류 해결


 

원인 - CentOS 8의 방화벽 running으로 인해 외부 접속을 차단하여 페이지 접속 불가능

 

$ firewall-cmd --state 

# running 이면 방화벽 중단 
$ systemctl stop firewalld

 

http://<ip address>:8888

외부에서 실행 성공

 

 

참고


드루이드 라우터 설정 - https://druid.apache.org/docs/latest/design/router.html

 

Router Process · Apache Druid

 

druid configuration _common -  http://druidio.cn/docs/0.9.0/configuration/index.html

 

Druid |

Table of Contents API documentation Configuring Druid This describes the common configuration shared by all Druid nodes. These configurations can be defined in the common.runtime.properties file. JVM Configuration Best Practices There are four JVM paramete

druidio.cn

 

'Database > Druid' 카테고리의 다른 글

Druid quickstart - Updating existing data  (0) 2020.08.28
Druid Quickstart  (0) 2020.08.21
How to install Druid 0.19.0 on Cent OS 8  (0) 2020.08.21
How to install Druid 0.13.0 on CentOS 8  (0) 2020.07.31
[MacOS] Druid 설치  (0) 2020.07.23

Download Druid 0.13.0


# wget으로 다운로드
$ wget https://archive.apache.org/dist/incubator/druid/0.13.0-incubating/apache-druid-0.13.0-incubating-bin.tar.gz

# 압축해제
$ tar -xzf apache-druid-0.13.0-incubating-bin.tar.gz

# 폴더로 이동
$ cd apache-druid-0.13.0-incubating

 

 

Download Zookeeper 3.4.11


# curl로 zookeeper 다운로드 3.4.11 버전
$ curl https://archive.apache.org/dist/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz -o zookeeper-3.4.11.tar.gz

# 압축해제
$ tar -xzf zookeeper-3.4.11.tar.gz

# zookeeper 이동
$ mv zookeeper-3.4.11 zk

druid 폴더 안에서 Zookeeper 설치

 

 

Druid 실행


# From the apache-druid-0.13.0-incubating package root, run the following command
$ bin/supervise -c quickstart/tutorial/conf/tutorial-cluster.conf

druid 실행

 

 

참고


https://druid.apache.org/docs//0.13.0-incubating/tutorials/tutorial-kafka.html

 

Druid | Tutorial: Load streaming data from Kafka

Table of Contents

 

'Database > Druid' 카테고리의 다른 글

Druid quickstart - Updating existing data  (0) 2020.08.28
Druid Quickstart  (0) 2020.08.21
How to install Druid 0.19.0 on Cent OS 8  (0) 2020.08.21
CentOS 8 에서 Druid Console 외부접속하기  (0) 2020.08.05
[MacOS] Druid 설치  (0) 2020.07.23

+ Recent posts