在windows的IDEA运行Presto
After building Presto for the first time, you can load the project into your IDE and run the server. We recommend using IntelliJ IDEA. Because Presto is a standard Maven project, you can import it into your IDE using the root pom.xml file
既然Presto的github首页推荐我们在IDEA运行服务器,那么我们就用IDEA来吧。
1、克隆项目 & checkout 版本
git clone https://github.com/prestodb/presto.git
git checkout 0.207
这里注意应该直接克隆项目,而不是下载代码导入IDEA,否则在后面构建程序的时候可能会出现关于git-comment-id-plugin的错误。
2、生成anltr4代码
在运行项目的时候,出现例如在presto-parser模块Cannot resolve symbol 'SqlBaseParser缺少代码的错误,这是因为源码不带anltr4的生成代码。可以在根目录运行生成anltr4代码的命令。
mvn antlr4:antlr4
在执行命令完成后,错误依旧没有消失,我们可以看看项目的结构。File -> Project Structure -> Modules -> presto-parser,将presto-parser的target -> generated-sources ->anltr4设置为Sources

3、设置Presto环境
Requirements
- Mac OS X or Linux
- Java 8 Update 92 or higher (8u92+), 64-bit. Both Oracle JDK and OpenJDK are supported.
- Maven 3.3.9+ (for building)
- Python 2.4+ (for running with the launcher script)
官网好像不支持windows,不过没关系,我们动些手脚让windows也能运行。
Presto comes with sample configuration that should work out-of-the-box for development. Use the following options to create a run configuration:
- Main Class: com.facebook.presto.server.PrestoServer
- VM Options: -ea -XX:+UseG1GC -XX:G1HeapRegionSize=32M -XX:+UseGCOverheadLimit -XX:+ExplicitGCInvokesConcurrent -Xmx2G -Dconfig=etc/config.properties -Dlog.levels-file=etc/log.properties
- Working directory: $MODULE_DIR$
- Use classpath of module: presto-main
按照下图设置好,就行:

4、修改文件
注释presto-main模块PrestoSystemRequirements的代码,相关代码片段用IDEA搜索功能查找
failRequirement("Presto requires Linux or Mac OS X (found %s)", osName);
修改文件描述符大小限制(手动改成10000):
private static OptionalLong getMaxFileDescriptorCount()
{
try {
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
//Object maxFileDescriptorCount = mbeanServer.getAttribute(ObjectName.getInstance(OPERATING_SYSTEM_MXBEAN_NAME), "MaxFileDescriptorCount");
Object maxFileDescriptorCount = 10000;
return OptionalLong.of(((Number) maxFileDescriptorCount).longValue());
}
catch (Exception e) {
return OptionalLong.empty();
}
}
下面a/b步骤可以根据目的选一个,a步不包含任何插件,可以快速调试接口。b步包含完整插件,有完整的功能:
a、接下来,把PluginManager的插件注释掉,
/*for (File file : listFiles(installedPluginsDir)) {
if (file.isDirectory()) {
loadPlugin(file.getAbsolutePath());
}
}
for (String plugin : plugins) {
loadPlugin(plugin);
}*/
把etc/catalog的配置文件全部改名为.properties.bak。
b、下载presto-server-0.207.tar.gz文件,解压到任意目录,把这里边的plugin目录作为IDEA工程的plugin目录,需要打开文件PluginManagerConfig.java,做如下修改:
// private File installedPluginsDir = new File("plugin");
private File installedPluginsDir = new File("D:\\presto-server-0.207\\plugin");
etc/catalog的配置文件根据需要改名为.properties.bak。
最后运行PrestoServer。
参考文献:
https://github.com/prestodb/presto
https://blog.csdn.net/sinat_27545249/article/details/72852148
在windows的IDEA运行Presto的更多相关文章
- 以Windows服务方式运行.NET Core程序
在之前一篇博客<以Windows服务方式运行ASP.NET Core程序>中我讲述了如何把ASP.NET Core程序作为Windows服务运行的方法,而今,我们又遇到了新的问题,那就是: ...
- 如何在Windows 10上运行Docker和Kubernetes?
如何在Windows 10上运行Docker和Kubernetes? 在Windows上学习Docker和Kubernetes,开始的时候会让你觉得无从下手.最起码安装好这些软件都不是一件容易的事情. ...
- [转帖]以Windows服务方式运行ASP.NET Core程序
以Windows服务方式运行ASP.NET Core程序 原作者blog: https://www.cnblogs.com/guogangj/p/9198031.htmlaspnet的blog 需要持 ...
- [转帖]以Windows服务方式运行.NET Core程序
以Windows服务方式运行.NET Core程序 原作者blog:https://www.cnblogs.com/guogangj/p/10093102.html 里面使用了NSSM 工具 但是自己 ...
- 连表查询都用Left Join吧 以Windows服务方式运行.NET Core程序 HTTP和HTTPS的区别 ASP.NET SignalR介绍 asp.net—WebApi跨域 asp.net—自定义轻量级ORM C#之23中设计模式
连表查询都用Left Join吧 最近看同事的代码,SQL连表查询的时候很多时候用的是Inner Join,而我觉得对我们的业务而言,99.9%都应该使用Left Join(还有0.1%我不知道在 ...
- webstorm git 怎么断开版本控制 webstorm git for windows 禁止 自动运行
也是无语啊,今天装了下最新版本的webstorm , 发现特别卡,老动不动就卡死, 看了下进程, 牛X 啊, git for windows 一直蹭蹭蹭的疯狂增长,一开始的一点到后来的庞然大物. ...
- windows bat文件运行中文乱码
windows bat文件运行中文乱码 CreationTime--2018年7月17日08点51分 Author:Marydon 1.情景展示 运行bat文件,里面的中文提示显示乱码 2.问题剖 ...
- 在windows环境下运行compass文件出现的错误提示解决方案
在windows环境下运行compass文件出现的错误提示解决方案 例如:经常在项目中运行grunt命令编译scss文件的时候,会出现下面的错误提示 (Encoding::CompatibilityE ...
- windows程序内部运行机制
Windows程序内部运行机制 2007-10-21 19:52 1010人阅读 评论(0) 收藏 举报 windowsvc++applicationcallbackwinapistructure W ...
随机推荐
- 简单说明webbench的安装和使用
简介 运行在linux上的一个性能测试工具 官网地址:http://home.tiscali.cz/~cz210552/webbench.html 如果不能打开的话,也可以直接到网盘下载:http:/ ...
- localStorage存储数组,对象,localStorage,sessionStorage存储数组对象
localStorage存储数组,对象,localStorage,sessionStorage存储数组对象 前言 最近在用angular做商城购物车的功能模块,因为angular的watch监听, ...
- python selenium 代码
from selenium import webdriver from selenium.common.exceptions import TimeoutException, NoSuchElemen ...
- php curl常用的5个例子
转载:http://www.jb100.net/html/content-22-821-1.html php curl常用的5个例子 我用php ,curl主要是抓取数据,当然我们可以用其他的方法 ...
- C语言版kafka消费者代码运行时异常kafka receive failed disconnected
https://github.com/edenhill/librdkafka/wiki/Broker-version-compatibility如果使用了broker版本是0.8的话, 在运行例程时需 ...
- SpringBoot(七)_统一异常处理
我感觉看了这节课,给我的思考还是很多的,感觉受益良多.废话不多说,一起学习. 统一的 外层结构返回 这样利于代码看着也规范,前端处理也统一 # 错误返回 { "code": 1, ...
- CKEditor 4 & markdown & rich text editor
CKEditor 4 ckeditor 4 http://ckeditor.com
- 【Nginx笔记】 fastcgi_param解释
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;#脚本文件请求的路径 fastcgi_param QUERY_STRI ...
- 用ul li实现边框重合并附带鼠标经过效果
边框重合这个效果并不难,只是我们没有真正的动手做过而已,下面让我们来谈谈用ul li如何实现边框重合,并附带鼠标经过效果 <!DOCTYPE html> <html lang=&qu ...
- Educational Codeforces Round 56 Div. 2 翻车记
A:签到. B:仅当只有一种字符时无法构成非回文串. #include<iostream> #include<cstdio> #include<cmath> #in ...