presto官网:Presto: Free, Open-Source SQL Query Engine for any Data
下载presto:
里面有各种版本的presto
https://repo1.maven.org/maven2/com/facebook/presto/presto-server/
例:
linux>wget https://repo1.maven.org/maven2/com/facebook/presto/presto-server/0.250/presto-server-0.250.tar.gz
linux>wget https://repo1.maven.org/maven2/com/facebook/presto/presto-cli/0.250/presto-cli-0.250-executable.jar
解压到 mv 到 /opt/install/presto
linux>tar -xf presto-server-0.250.tar.gz
linux>mv presto-server-0.250 /opt/install/presto
创建目录:
linux>cd presto
linux>mkdir data
linux>mkdir etc
编辑配置文件
linux>cd etc
linux>vi jvm.config
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
linux/etc>mkdir catalog
linux/etc>cd catalog
linux/catalog>vi hive.properties
connector.name=hive-hadoop2 #hive-hadoop2 名字是固定的
hive.metastore.uri=thrift://192.168.58.201:9083
hive.config.resources=/opt/install/hadoop/etc/hadoop/core-site.xml,/opt/install/hadoop/etc/hadoop/hdfs-site.xml
分发到其他节点
linux>scp -r presto/ 192.168.58.201:`pwd`
linux>scp -r presto/ 192.168.58.202:`pwd`
在 presto的etc 目录下编辑文件
主机1:192.168.58.200
linux>vi node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/opt/install/presto/data
linux>vi config.properties
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery-server.enabled=true
discovery.uri=http://192.168.58.200:8881
主机2:192.168.58.201
linux>vi node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-fffffffffffe
node.data-dir=/opt/install/presto/data
linux>vi config.properties
coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery.uri=http://192.168.58.200:8881
主机3:192.168.58.202
linux>vi node.properties
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-fffffffffffd
node.data-dir=/opt/install/presto/data
linux>vi config.properties
coordinator=false
http-server.http.port=8881
query.max-memory=50GB
discovery.uri=http://192.168.58.200:8881
启动 hive的服务 bin/hive --service metastore (不行的话所有都启动) 因为 192.168.58.201 hive-site.xml 指定的是192.168.58.201 所以在这台上启动hive --service metastore
配置文件如下的hive: vi hive-site.xml
192.168.58.201>vi hive-site.xml
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://nodefive:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>12345</value>
</property>
<property>
<name>hive.metastore.thrift.bind.host</name>
<value>192.168.58.201</value>
</property>
</configuration>
分别启动服务 :
进入presto运行
主机1:192.168.58.200
linux>bin/launcher run
主机2:192.168.58.201
linux>bin/launcher run
主机3:192.168.58.202
linux>bin/launcher run
presto 的客户端
linux>mv presto-cli-0.196-executable.jar prestocli
linux>chmod +x prestocli
进入客户端方法:
linux>./prestocli --catalog hive --schema default --server 192.168.58.200:8881
linux>./prestocli --catalog hive --schema default --server 192.168.58.200:8881 --catalog hive --schema default
注:启动presto
不加 --schema 的话就是全部数据库,查询时候需要用 数据库名.表名 的方式查询
例:
presto>select * from schema.table limit 100
进入后常用命令:
presto>show schemas查看数据库
presto>show tables from SchemaName; 查看 数据库的表
或者
presto>use SchemaName;
presto>show tables; 查看当下数据库下的所有表
注:命令跟hive差不多更多命令例子可参presto考官网
presto SQL应用官网:https://prestodb.io/docs/current/sql.html
presto SQL应用官网:https://prestodb.io/docs/current/sql.html
报错:
ERROR main com.facebook.presto.server.PrestoServer Unable to create injector, see the following errors:
1) Error injecting constructor, java.io.IOException: java.io.IOException: Can not attach to current VM (try adding '-Djdk.attach.allowAttachSelf=true' to the JVM config)
解决办法:编辑jvm.config 文件添加配置-Djdk.attach.allowAttachSelf=true后重启presto服务
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-Djdk.attach.allowAttachSelf=true
打开浏览器输入地址192.168.58.200:8881即可访问UI文章来源:https://www.toymoban.com/news/detail-406577.html
文章来源地址https://www.toymoban.com/news/detail-406577.html
到了这里,关于Presto 安装部署与介绍的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!