在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 ...
随机推荐
- PAT 甲级 1137 Final Grading
https://pintia.cn/problem-sets/994805342720868352/problems/994805345401028608 For a student taking t ...
- Load generator连接失败的解决办法!(转)
环境:1.loadrunner control 一台物理机(win2008r2) 2.loadrunner agent 两台物理机(win2008r2) 问题:loadrunner control 连 ...
- 相见恨晚的 scala - 01 [ 基础 ]
简洁到不行,多一个分号都是不应该. 学习笔记: centOS 下安装 scala 和安装 jdk 一毛一样 . 1 . 不同于 Java 的变量声明 :( 但是和 js 很像 ) /** * Crea ...
- js & listen mouse click
js & listen mouse click how to listen mouse click in js https://www.kirupa.com/html5/mouse_event ...
- Qt——线程与定时器
一.定时器QTimer类 The QTimer class provides repetitive and single-shot timers. The QTimer class provides ...
- Matplotlib风羽自定义
[前言]对于气象专业的小学生来说,风场是预报重要的参考数据,我们所知的风羽有四种:短线代表风速2m/s,长线代表风速4m/s,空心三角代表风速20m/s,实心三角代表风速50m/s.而matplotl ...
- 【刷题】BZOJ 3669 [Noi2014]魔法森林
Description 为了得到书法大家的真传,小E同学下定决心去拜访住在魔法森林中的隐士.魔法森林可以被看成一个包含个N节点M条边的无向图,节点标号为1..N,边标号为1..M.初始时小E同学在号节 ...
- 学习Spring Boot:(七)集成Mybatis
前面都是用的是spring data JPA,现在学习下Mybatis,而且现在Mybatis也像JPA那样支持注解形式了,也非常方便,学习一下. 数据库 mysql 5.7 添加依赖 在pom文件中 ...
- CF960G Bandit Blues 【第一类斯特林数 + 分治NTT】
题目链接 CF960G 题解 同FJOI2016只不过数据范围变大了 考虑如何预处理第一类斯特林数 性质 \[x^{\overline{n}} = \sum\limits_{i = 0}^{n}\be ...
- 洛谷 P2915 [USACO08NOV]奶牛混合起来Mixed Up Cows 解题报告
P2915 [USACO08NOV]奶牛混合起来Mixed Up Cows 题意: 给定一个长\(N\)的序列,求满足任意两个相邻元素之间的绝对值之差不超过\(K\)的这个序列的排列有多少个? 范围: ...