ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 분산 쿼리 엔진 prestoSQL의 바뀐 이름 Trino
    Review 2022. 1. 4. 00:31

    귀엽다...

    Trino? 처음듣는데?


    Trino v.s. PrestoDB


    What's the Difference Between Trino and PrestoDB?

     

    What’s the Difference Between Trino and PrestoDB?

    Read on to find out more about Trino and PrestoDB, what makes them unique, their differences, and discover which solution is better.

    pandio.com

    • 위 글은 제목은 비교하는 글이지만 막상 내용은 Trino를 추천하는 단락이 더 많다.
    • prestoDB 용량 1.1G v.s. Trino 용량 607MB
    • Trino는 제한적이지만 Oracle Connector를 사용할 수 있음(2020년 말부터는 PrestoDB도 Oracle Connector 지원)
    • 정리하자면 presto의 핵심 개발자들이 참여하는 Trino의 오픈소스 활동이 더 활발하고 다양한 DB에 대한 지원과 편의성이 빠르게 늘어나며 최적화 되어있어서 Trino를 더 권장

    Config


    https://trino.io/docs/current/installation/deployment.html

     

    Deploying Trino — Trino 367 Documentation

    Deploying Trino Requirements Linux operating system 64-bit required newer release preferred, especially when running on containers adequate ulimits for the user that runs the Trino process. These limits may depend on the specific Linux distribution you are

    trino.io

    coordinator와 worker

    • 트리노는 2가지 타입의 서버가 있다 코디네이터와 워커
    • 코디네이터는 쿼리를 플래닝하고 워커 노드들을 매니징한다.
    • 테스트 목적으로는 싱글 인스턴스에서 코디네이터와 워커 두가지 역할을 동시해 하도록 할 수 있지만 그렇지 않은 경우에는 코디네이터 하나에 워커 하나 또는 그 이상을 함께 설치해야한다.
    • 코디네이터는 워커와 클라이언트들과 REST API를 사용해서 통신한다.
    • 워커들은 task들을 수행하고 데이타들을 프로세싱한다.
    • 코디네이터들은 워커들로부터 받은 결과들을 최종적으로 클라이언트에 리턴해주는 것을 담당한다.

    config.properties

    기본적으로는 단일 노드로 돌아가지만 프로덕션 레벨에서는 코디네이터와 워커로 따로 분리해서 trino를 실행한다.
    코디네이터 역할을 하는 노드는 아래 configure를 적용해서 실행하고 워커 역할을 하는 노드에서는 두번째 configure를 적용해서 실행하면 된다.

    • coordinator minimal configuration
    coordinator=true
    node-scheduler.include-coordinator=false
    http-server.http.port=8080
    query.max-memory=50GB
    query.max-memory-per-node=1GB
    query.max-total-memory-per-node=2GB
    discovery.uri=http://example.net:8080
    
    • worker minimal configuration
    coordinator=false
    http-server.http.port=8080
    query.max-memory=50GB
    query.max-memory-per-node=1GB
    query.max-total-memory-per-node=2GB
    discovery.uri=http://example.net:8080
    

    node.properties

    • 각 노드들의 설정, 노드 아이피 명시, 환경명 명시(클러스터들끼리 동일한 환경의 이름을 가져야함)
    • production일 경우 환경명을 production으로 수정해서 사용
    node.environment=development
    node.data-dir=/data/trino

    jvm.config

    • jvm 메모리 설정
    -server
    -Xmx16G
    -XX:-UseBiasedLocking
    -XX:+UseG1GC
    -XX:G1HeapRegionSize=32M
    -XX:+ExplicitGCInvokesConcurrent
    -XX:+ExitOnOutOfMemoryError
    -XX:+HeapDumpOnOutOfMemoryError
    -XX:-OmitStackTraceInFastThrow
    -XX:ReservedCodeCacheSize=512M
    -XX:PerMethodRecompilationCutoff=10000
    -XX:PerBytecodeRecompilationCutoff=10000
    -Djdk.attach.allowAttachSelf=true
    -Djdk.nio.maxCachedBufferSize=2000000
    

    log.properties

    • log level 설정
    io.trino=INFO
    

    hive.properties

    • AWS glue 메타스토어 연결
    connector.name=hive-hadoop2
    hive.metastore=glue
    hive.metastore.glue.aws-access-key=
    hive.metastore.glue.aws-secret-key=
    hive.s3.aws-access-key=
    hive.s3.aws-secret-key=
    hive.allow-drop-table=true
    

     

    Dashboard


    • docker로 간단하게 단일 노드의 trino를 시작할 수 있다.
    • 위 config를 적용하기 위해서는 로컬의 디렉토리에 config들을 작성 후에 마운트해서 -v 옵션으로 docker를 실행해주면 된다.
    • 코디네이터와 워커를 분리해서 실행하고 싶다면 docker-compose를 이용해서 이어주도록 하자.
    docker run -p 8080:8080 trinodb/trino

    localhost:8080로 접속하면 대쉬보드를 확인할 수 있다.

     

    Client


    • JDBC를 통해 클라이언트에서 원격 연결이 가능하다. 아래 사진은 DBeaver에서 trino를 연결하는 방법

    새로운 커넥션을 추가할 때 trino로 검색하고 다음을 누른다.

    docker를 통해 포트포워딩으로 로컬의 8080과 JDBC로 연결하고 완료를 누른다.

    연결을 위한 드라이버 라이브러리를 설치한 후에 접속할 수 있다.

    댓글

Copyright 2023. 은유 All rights reserved.