知识点
相关文章
更多最近更新
更多运行Solr
2019-03-27 01:12|来源: 网路
我是下载的apache-solr-1.4.1
解压,取出apache-solr-1.4.1\dist\apache-solr-1.4.1.war,改名为solr.war放到Tomcat的webapp目录下
设置SolrHome,这个主要是设置 apache-solr-1.4.1/example/solr这个文件夹的位置,这里面放了solr的配置信息
互联网上说有三种方式。
1,让服务器在包含solr的目录中启动,或者把solr放到服务器的启动目录中。总的来说是要solr和服务器在一个目录中。tomcat的话就是把solr放到bin目录中。
2,设置系统环境变量。经查证,这是不行的。绝对不行!
3,设置JNDI,这个可以。
我查找了solr是如何找到solrhome然后加载配置文件的。
/**
327 * Determines the instanceDir from the environment.
328 * Tries JNDI (java:comp/env/solr/home) then system property (solr.solr.home);
329 * if both fail, defaults to solr/
330 * @return the instance directory name
331 */
332 /**
333 * Finds the instanceDir based on looking up the value in one of three places:
334 * <ol>
335 * <li>JNDI: via java:comp/env/solr/home</li>
336 * <li>The system property solr.solr.home</li>
337 * <li>Look in the current working directory for a solr/ directory</li>
338 * </ol>
339 *
340 * The return value is normalized. Normalization essentially means it ends in a trailing slash.
341 * @return A normalized instanceDir
342 *
343 * @see #normalizeDir(String)
344 */
345 public static String locateInstanceDir() {
346 String home = null;
347 // Try JNDI
348 try {
349 Context c = new InitialContext();
350 home = (String)c.lookup("java:comp/env/"+project+"/home");
351 log.info("Using JNDI solr.home: "+home );
352 } catch (NoInitialContextException e) {
353 log.info("JNDI not configured for "+project+" (NoInitialContextEx)");
354 } catch (NamingException e) {
355 log.info("No /"+project+"/home in JNDI");
356 } catch( RuntimeException ex ) {
357 log.warning("Odd RuntimeException while testing for JNDI: " + ex.getMessage());
358 }
359
360 // Now try system property
361 if( home == null ) {
362 String prop = project + ".solr.home";
363 home = System.getProperty(prop);
364 if( home != null ) {
365 log.info("using system property "+prop+": " + home );
366 }
367 }
368
369 // if all else fails, try
370 if( home == null ) {
371 home = project + '/';
372 log.info(project + " home defaulted to '" + home + "' (could not find system property or JNDI)");
373 }
374 return normalizeDir( home );
375 }
互联网上说的通过环境变量的方式是在第363行,其中的project值为solr.所以环境变量的应当为solr.solr.home.
可是System.getProperty是获取系统属性,不是获到环境变量.获取环境变量的方式应当是:System.getenv
至少在我的机器上面是这样,如果你的机器上面也取不到.那么你就应当和我是一样的.原文中的注释也是这么说的。
最后,我采用了第一种方式,直接把example\solr文件夹丢到tomcat的bin目录中.现在启动tomcat
访问http://localhost:8080/solr出现
Welcome to Solr!
就安装成功了。
转自:http://www.cnblogs.com/codewater/articles/1789986
相关问答
更多-
试试像这样: nohup yourcommand > output.log 2>&1 & nohup将防止您在注销事件中终止您的命令。 &将在后台运行它。 > output.log将把stdout发送到output.log 2>&1会将stderr重定向到stdout Try something like: nohup yourcommand > output.log 2>&1 & nohup will prevent yourcommand from being terminated in the e ...
-
您可能忘记提交新文档,例如添加后: curl http://localhost:8983/solr/update -F stream.body='
' You probably forgot to commit the new documents, e.g. after adding: curl http://localhost:8983/solr/update -F stream.body=' ' -
你有没有机会升级以前的Solr发行版? 在这种情况下,您可能会有旧文件,例如来自分发中war文件的解压缩webapp目录。 您可能需要删除它们,从命令行运行Solr一次,然后重试。 Did you by any chance upgrade from previous Solr distribution? In which case, you may have old files lying around, such as unpacked webapp directory that comes from ...
-
在Solr管理页面上单击[INFO] 。 下一个屏幕将有版本。 (对于我来说,Solr管理页面位于:http:// {host-name-or-ip}:{port} / solr / admin,我发现我正在处理一个较旧的版本。 0 Solr实现版本:1.4.0 833479) On the Solr Admin page click on [INFO]. The next screen will have the version. (For me, the Solr admin page is locat ...
-
可以在此处找到Solr要求: https : //wiki.apache.org/solr/SolrInstall 因此需要安装JRE,还需要一个servlet容器,它也需要一个JRE。 如果我在你的情况下,我会租用一个虚拟服务器。 另一种选择是托管服务,专门用于solr托管:在网上搜索“apache solr hosting”。 酒店还提供免费或付费优惠。 The Solr requirements can be found here: https://wiki.apache.org/solr/SolrI ...
-
您可以通过Solr模式API和Solr config API读取当前正在运行的模式和配置。 注意:此API的结果不是原始schema.xml或solrconfig.xml文件,但您可以从中重建原始文件。 同样,请注意Solr配置API仅在最新版本的Solr中可用。 在较旧的版本中(我测试版本4.8.1)没有solr配置的API,因此无法完全重建solrconfig.xml文件。 You can read the current running schema and config through the So ...
-
我们将Solr配置与Eclipse项目中的相应war文件保持在一起。 我将把这个项目称为your project here 。 这样我们就可以将所有东西放在一个地方 战争档案 指数 配置 你需要做的是 1)在eclipse中创建一个空的tomcat服务器 2)将-Dsolr.solr.home=${resource_loc:/
/solr/home}到该tomcat的VM参数 3)将solr war文件作为 到该tomcat的server.xml We a ... -
不知道SOLR是如何工作的,但正确的jQuery将是: $.ajax({ type: "GET", url: "http://127.0.0.1:8080/solr/select?q=iphon&wt=json&json.wrf=?", dataType: "json", success: function (result) { // is working }, error: function (result) { // pro ...
-
已经为java7编译了Solr 4.9.0。 我发现为java6编译的最后一个版本是4.7.2。 您可以在项目的pom.xml中看到这一点(相关部分转载如下)。
maven-compiler-plugin 3.1 1.6 ... -
此问题可能与Solr节点上的RAM大小有关。 如果在具有较小RAM大小的VM上运行Solr,则启用交换或增加RAM应解决此问题。 Had to update to java 1.8 This was useful