分佈式SQL查詢引擎---presto介紹,連接器

全棧工程師開發手冊 (作者:欒鵬)
架構系列文章

presto 官方文檔:https://prestodb.github.io/docs/current/

問題反饋網頁:https://www.bookstack.cn/read/Presto0.220Documentation/03a7a969a258040b.md

Presto安裝與配置

https://blog.csdn.net/zyj8170/article/details/60954885

presto 集成hive

# 配置內容可以參考https://prestodb.github.io/docs/current/connector/hive.html            https://prestodb.github.io/docs/current/connector/hive-security.html
  hive.properties: |
    connector.name=hive-hadoop2
    hive.metastore.uri=thrift://hadoop-hive-service:9083
    hive.metastore.username=root
    hive.allow-drop-table=true
    hive.immutable-partitions=false
    hive.allow-rename-table=true
    hive.allow-add-column=true
    hive.allow-drop-column=true
    hive.allow-rename-column=true

presto 集成mysql

  mysql.properties: |
    connector.name=mysql
    connection-url=jdbc:mysql://mysql-service:3306?useCursorFetch=true&defaultFetchSize=10000
    connection-user=root
    connection-password=admin

presto集成es

  elasticsearch.properties: |
    connector.name=elasticsearch
    elasticsearch.default-schema=default
    elasticsearch.table-description-directory=etc/elasticsearch/
    elasticsearch.scroll-size=1000
    elasticsearch.scroll-timeout=2s
    elasticsearch.request-timeout=2s
    elasticsearch.max-request-retries=5
    elasticsearch.max-request-retry-time=10s

同時需要創建表格信息

  capture_table.json: |
    {
        "tableName": 'es_test',
        "host": 'elasticsearch-client',
        "port": 9200,
        "clusterName": 'elasticsearch',
        "index": 'test',
        "indexExactMatch": 'true',
        "type": 'capture'
    }

presto集成postgresql

  postgresql.properties: |
    connector.name=postgresql
    connection-url=jdbc:postgresql://postgres:5432/userprofile
    connection-user=root
    connection-password=admin

連接多個database 或多個服務器,參考:https://prestodb.github.io/docs/current/connector/postgresql.html

presto客戶端sql操作

語法參考:https://blog.csdn.net/Lnho2015/article/details/51428782

presto進入命令行

進入hive 數據庫(可以不攜帶--schema yourdatabase參數,進入後使用use yourdatabase切換)
presto --server localhost:8080 --catalog hive --schema yourdatabase

進入mysql數據庫(可以不攜帶--schema yourdatabase參數,進入後使用use yourdatabase切換)
presto --server localhost:8080 --catalog mysql --schema yourdatabase

進入postgresql數據庫
presto --server localhost:8080 --catalog postgresql 
查詢可以schemas
show schemas from postgresql;
use public
show tables;

# 連接es數據庫(映射成presto表以後的)

發佈了628 篇原創文章 · 獲贊 2834 · 訪問量 405萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章