文档章节

Debug solr

K
 Kadima
发布于 2015/11/09 17:42
字数 613
阅读 80
收藏 0

Recently I was puzzled by some behavior Solr was showing me. I scratched my head and called over a colleague. We couldn’t quite figure out what was going on. Well Solr is open source so… next stop – Debuggersville! Running Solr in the Eclipse debugger isn’t hard, but there are many scattered user group posts and blog articles that you’ll need to manually tie together into a coherent picture. So let me do you the favor of tying all of that info together for you here. First step is of course to [grab the source code][1] for the version of Solr you want to debug. Unpack this somewhere, and browse to the top directory. Let’s get comfortable with the directory structure. Most importantly, I want to point out these three pieces: * build.xml – top level Solr/Lucene ant build.xml file * lucene/ — directory containing Lucene’s source * solr/ — directory containing Solr’s source The takeaway here is that it’s important to note that Solr and Lucene are deployed together. This has a lot of conveniences, but is a bit confusing. We think we just downloaded Solr, but really we have Solr and Lucene bundled together. To help keep things clear, I’m going to call the whole shebang we just downloaded the **Solr/Lucene** source tree and I’ll call the `solr/` subdirectory the Solr source tree.Debug Solr Directory Structure

My Solr/Lucene Source Tree

OK enough nonsense, let’s get started. Browse to the top-level Solr/Lucene source tree in your command line and let’s bootstrap the Solr/Lucene Eclipse project.

~/workspace/solr-4.2.1$ ant eclipse

Once this completes, load up Eclipse, and select File -> Import. Select Existing Eclipse Project from the dialog and browse to the top of your Solr/Lucene source tree. Once this directory is selected, click “Finish”. Now you have an Eclipse project with both Solr and Lucene.

Import Solr Lucene Into Eclipse

Import Solr/Lucene Into Eclipse

Now back to the command prompt, we’ll go into the Solr source tree and build the example/ directory that holds the Solr/Jetty web application. The same example/ directory distributed with Solr`s binaries.

~/workspace/solr-4.2.1$ cd solr/ ~/workspace/solr-4.2.1/solr$ ant example

Once the example app has been built, we can cd into the example directory, and use start.jar in the same way we would with the binary distribution of Solr. We can still include the usual solr arguments for items such as changing solr.home, etc. The only difference here is we’re going add Java arguments needed for debugging.

~/workspace/solr-4.2.1/solr$ cd example ~/workspace/solr-4.2.1/solr/example$ java -jar -Xdebug \      -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 \      start.jar

Because we set suspend=y, Java is waiting for us to attach our debugger before beginning execution. Switch back to Eclipse. Right click on your Solr/Lucene Java project and select Debug As and then Debug Configurations. Under theRemote Java Application category. Click New to create a new debug configuration. Enter in the port we just specified to Java at the command line — 1044. Hit Apply and Debug. Over in the command line you should see Solr starting up.

Remote Debug Solr

Debug Config For Attaching to Example Web App

Huzzah! You’ve done it! You should now be able to set breakpoints throughout the Solr/Lucene code base, step through code, and do all the other fun stuff you can do with any other hunk of source code. In the future, you can simply recall this debug configuration in the “Debug As” menu and Eclipse will attempt to attach to any Solr instance launched with Java’s debug commands. Have fun hacking on Solr!


© 著作权归作者所有

K
粉丝 5
博文 20
码字总数 8451
作品 0
崇明
私信 提问
SolrCloud 4.3.1+Tomcat 7安装配置实践

我们使用Solr Replication可以实现Solr服务器的可用性,即使某一个索引副本由于磁盘介质故障或者误操作删除等,其他的多个复制副本仍然可以提供服务。如果只是单纯的基于Solr Replication技术...

张升强
2014/03/26
125
0
使用idea 调试solr源代码

1,下载solr源代码,选择需要的版本,解压后此目录后文将称为SOLR-HOME 2,在SOLR-HOME,下执行ant idea 在import idea时一直选择next即可 3,SOLR-HOME/solr下执行ant example命令 在此过程中...

Kadima
2015/11/12
1K
0
玩转Apache Solr 6.5.1

以下都是基于linux环境 参考链接:http://lucene.apache.org/solr/quickstart.html 目录: solr 基本命令总结 solr 命令参数详解 solr 查询语法详解 solr schema配置详解 1. solr基本命令总结...

㭍葉
2017/05/31
0
0
Apache Solr DataImportHandler远程代码执行漏洞(CVE-2019-0193) 分析

作者:Longofo@知道创宇404实验室 时间:2019年8月8日 漏洞概述 2019年08月01日,Apache Solr官方发布预警,Apache Solr DataImport功能 在开启Debug模式时,可以接收来自请求的"dataConfig...

知道创宇404实验室
08/09
0
0
设置solr.home的方式

一、基于JNDI配置 Tomcat启动的时候就会该目录下自动获取 SolrHome的信息. 在你安装tomcat的根目录下,找到或者新建路径:confCatalinalocalhost; 根据你部署的项目名称,新建一个XML文件,如...

皮蛋瘦肉粥里没有粥
2016/01/15
5
0

没有更多内容

加载失败,请刷新页面

加载更多

UAVStack功能上新:新增JVM监控分析工具

UAVStack推出的JVM监控分析工具提供基于页面的展现方式,以图形化的方式展示采集到的监控数据;同时提供JVM基本参数获取、内存dump、线程分析、内存分配采样和热点方法分析等功能。 引言 作为...

宜信技术学院
7分钟前
1
0
MySQL的5种时间类型的比较

日期时间类型 占用空间 日期格式 最小值 最大值 零值表示 DATETIME 8 bytes YYYY-MM-DD HH:MM:SS 1000-01-01 00:00:00 9999-12-31 23:59:59 0000-00-00 00:00:00 TIMESTAMP 4 bytes YYYY-MM......

物种起源-达尔文
14分钟前
3
0
云服务OpenAPI的7大挑战,架构师如何应对?

阿里妹导读:API 是模块或者子系统之间交互的接口定义。好的系统架构离不开好的 API 设计,而一个设计不够完善的 API 则注定会导致系统的后续发展和维护非常困难。比较好的API设计样板可以参...

阿里云官方博客
17分钟前
1
0
Rancher + VMware PKS实现全球数百站点的边缘K8S集群管理

Sovereign Systems是一家成立于2007年的技术咨询公司,帮助客户将传统数据中心技术和应用程序转换为更高效的、基于云的技术平台,以更好地应对业务挑战。曾连续3年提名CRN,并且在2012年到2...

RancherLabs
22分钟前
2
0
6、根据坐标,判断该坐标是否在地图区域范围内

最近在写配送区域相关的代码,具体需求如下: 根据腾讯地图划分配送区域,总站下边设多个配送分站,然后将订单中的收货地址将其分配给不同的配送分站。 1、地图区域划分(腾讯地图) 1.1、H...

有一个小阿飞
24分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部