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的更多相关文章

  1. 以Windows服务方式运行.NET Core程序

    在之前一篇博客<以Windows服务方式运行ASP.NET Core程序>中我讲述了如何把ASP.NET Core程序作为Windows服务运行的方法,而今,我们又遇到了新的问题,那就是: ...

  2. 如何在Windows 10上运行Docker和Kubernetes?

    如何在Windows 10上运行Docker和Kubernetes? 在Windows上学习Docker和Kubernetes,开始的时候会让你觉得无从下手.最起码安装好这些软件都不是一件容易的事情. ...

  3. [转帖]以Windows服务方式运行ASP.NET Core程序

    以Windows服务方式运行ASP.NET Core程序 原作者blog: https://www.cnblogs.com/guogangj/p/9198031.htmlaspnet的blog 需要持 ...

  4. [转帖]以Windows服务方式运行.NET Core程序

    以Windows服务方式运行.NET Core程序 原作者blog:https://www.cnblogs.com/guogangj/p/10093102.html 里面使用了NSSM 工具 但是自己 ...

  5. 连表查询都用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%我不知道在 ...

  6. webstorm git 怎么断开版本控制 webstorm git for windows 禁止 自动运行

    也是无语啊,今天装了下最新版本的webstorm ,  发现特别卡,老动不动就卡死, 看了下进程, 牛X 啊,  git for windows 一直蹭蹭蹭的疯狂增长,一开始的一点到后来的庞然大物. ...

  7. windows bat文件运行中文乱码

      windows bat文件运行中文乱码 CreationTime--2018年7月17日08点51分 Author:Marydon 1.情景展示 运行bat文件,里面的中文提示显示乱码 2.问题剖 ...

  8. 在windows环境下运行compass文件出现的错误提示解决方案

    在windows环境下运行compass文件出现的错误提示解决方案 例如:经常在项目中运行grunt命令编译scss文件的时候,会出现下面的错误提示 (Encoding::CompatibilityE ...

  9. windows程序内部运行机制

    Windows程序内部运行机制 2007-10-21 19:52 1010人阅读 评论(0) 收藏 举报 windowsvc++applicationcallbackwinapistructure W ...

随机推荐

  1. 利用ceye中的dns来获取数据

    安恒杯的一道命令执行题目 查看,存在robots.txt文件 查看index.txt文件,存在where_is_flag.php文件 使用cat没有任何回显 可以使用ceye平台利用dns记录内容,网 ...

  2. 读书笔记-《Linux/Unix设计思想》

    本书主要讲的是Unix程序设计思想,具体涉及到linux的内容不多. 整本书的一个基本出发点是开源.其中主要强调的观点包括: 1.小即是美 作者持有的主要观点是程序应该以小为美.小程序实现小功能,每个 ...

  3. Linux限制cpu睿频&限制频率

    .关闭睿频 > /sys/devices/system/cpu/intel_pstate/no_turbo .限制CPU最大频率到50% " | sudo tee /sys/devic ...

  4. DataTable List 相互转换

    This uses the FastMember's meta-programming API for maximum performance. If you want to restrict it ...

  5. p2 弹簧

    P2中用来约束刚体运动的还有弹簧Spring. 弹簧除约束两个刚体之间的运动轨迹外,通过damping阻尼和stiffness刚度系数等属性,使得刚体在向目标移动时, 出现类似弹簧的简谐运动.Spri ...

  6. IDEA 开发工具的快捷键

    IDEA 开发工具的快捷键 原文链接:http://blog.csdn.net/wfp458113181wfp/article/details/24579781 1.文本编辑 删除    ctr + ...

  7. 使用flex布局调换两个按钮的位置

    组件用的时antd的Modal组件,里面的按钮需要调换一下位置 今天发现用flex布局非常方便,代码如下: display: flex; justify-content: center; flex-f ...

  8. window.location.hash 使用

    [转]http://www.cnblogs.com/nifengs/p/5104763.html location是javascript里边管理地址栏的内置对象,比如location.href就管理页 ...

  9. Swagger实现API文档功能

    介绍: wagger也称为Open API,Swagger从API文档中手动完成工作,并提供一系列用于生成,可视化和维护API文档的解决方案.简单的说就是一款让你更好的书写API文档的框架. 我们为什 ...

  10. python自动化之web抓取

    ''' 从web抓取数据: webbrowser:是python自带的,打开浏览器获取指定页面. requests:从因特网上下载文件和网页. Beautiful Soup:解析HTML,即网页编写的 ...