分布式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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章