presto on redis

本文档详细介绍了如何在Presto中安装和配置Presto服务器,并连接到Redis数据库。步骤包括下载和安装Presto,配置节点和连接器,以及在Redis中插入数据并使用Presto-CLI进行查询。
摘要由CSDN通过智能技术生成

Presto on redis 

PRESTO的安装和配置

1 安装

1 下载presto包

(1)

wget https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.179/presto-server-0.179.tar.gz

2 上传presto包上传到服务器

将(1)上传至10.118.242.72  10.118.242.75 10.118.242.76  /usr/local/下

3 解压presto包

tar –zxvf /usr/local/presto-server-0.179.tar.gz

2 配置presto

在3台机器/usr/local/presto-server-0.179下创建etc目录

共创建4个配置文件

node.properties

 

node.environment=production

node.id=72 #其他机器相应修改

node.data-dir=/data/presto/data

 

config.properties (72)

 

coordinator=true

node-scheduler.include-coordinator=false

http-server.http.port=8185

query.max-memory=50GB

query.max-memory-per-node=1GB

discovery-server.enabled=true

discovery.uri=http://10.118.242.72:8185

 

config.properties (75/76)

 

coordinator=false

http-server.http.port=8185

query.max-memory=50GB

query.max-memory-per-node=1GB

discovery.uri=http://10.118.242.72:8185

 

jvm.config

 

-server

-Xmx16G

-XX:+UseG1GC

-XX:G1HeapRegionSize=32M

-XX:+UseGCOverheadLimit

-XX:+ExplicitGCInvokesConcurrent

-XX:+HeapDumpOnOutOfMemoryError

 

log.properties

 

com.facebook.presto=INFO

3 参考文档

https://prestodb.io/docs/current/index.html

Redis connnector的安装和配置

1 配置

在3台机器的/usr/local/presto-server-0.179/etc/下创建catalog/redis.properties文件

 

connector.name=redis

redis.table-names=redis.cytest

redis.nodes=10.118.242.75:6379   #按照实际情况配置

redis.hide-internal-columns=false

redis.password=sfdp

 

在3台机器的/usr/local/presto-server-0.179/etc/下创建redis/cytest.json文件

 

{

   "tableName": "cytest",

   "schemaName": "redis",

   "key": {

       "dataFormat": "raw",

       "fields": [

            {

                "name":"redis_key",

                "dataFormat":"_default",

                "type":"VARCHAR",

                "hidden":"false"

           }

       ]

   },

   "value": {

       "dataFormat": "json",

       "fields": [

           {

                "name":"row_number",

                "mapping":"rowNumber",

                "type":"BIGINT"

           },

           {

                "name":"customer_key",

                "mapping":"customerKey",

                "type":"BIGINT"

           },

           {

                "name":"name",

                "mapping":"name",

                "type":"VARCHAR"

           }

      ]

    }

}

Presto onredis的例子

1 启动presto

分别在3台机器启动presto server

/usr/local/presto-server-0.179/bin/launcherstart

日志在/data/presto/data/var/log/server.log

2 在redis插入数据

set key1 "{\"rowNumber\":1,\"customerKey\":1,\"name\":\"Customer#000000001\"}"

 setkey2"{\"rowNumber\":3,\"customerKey\":3,\"name\":\"Customer#000000003\"}"

 setkey3"{\"rowNumber\":5,\"customerKey\":5,\"name\":\"Customer#000000005\"}"

 setkey4 "{\"rowNumber\":7,\"customerKey\":7,\"name\":\"Customer#000000007\"}"

 setkey5"{\"rowNumber\":9,\"customerKey\":9,\"name\":\"Customer#000000009\"}"

 setkey6"{\"rowNumber\":9,\"customerKey\":19,\"name\":\"Customer#0000000019\"}"

3 在presto-cli查询

下载presto-cli

wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.179/presto-cli-0.179-executable.jar

将jar文件放在/usr/local/presto-server-0.179/bin/

执行

/usr/local/presto-server-0.179/bin/presto-cli-0.179-executable.jar--server 10.118.242.72:8185 --catalog redis --schema redis

 

写入sql

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值