java Solr配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6645253/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 16:46:41  来源:igfitidea点击:

Solr Configuration

javasolr

提问by rocco

I tried to installed Solr using:

我尝试使用以下方法安装 Solr:

java -jar start.jar

However I downloaded the source code and didn't compile it (Didn't pay attention). And the error was:

但是我下载了源代码并没有编译它(没注意)。错误是:

http://localhost:8983/solr/admin/

HTTP ERROR: 404
Problem accessing /solr/admin/. Reason:
NOT_FOUND 

Then I downloaded the compiled version of solr but when trying to run the example configuration I'm getting exception:

然后我下载了 solr 的编译版本,但是在尝试运行示例配置时出现异常:

java.net.BindException: Address already in use 

Is there a way to revert solr configuration and start from scratch? Looks like the configuration got messed up. I don't see anything related to it in the manual.

有没有办法恢复 solr 配置并从头开始?看来配置搞砸了。我在手册中没有看到与它相关的任何内容。

Here is the error:

这是错误:

2011-07-10 22:41:27.631:WARN::failed [email protected]:8983: java.net.BindException: Address already in use
2011-07-10 22:41:27.632:WARN::failed Server@c4e21db: java.net.BindException: Address already in use
2011-07-10 22:41:27.632:WARN::EXCEPTION 
java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
    at java.net.ServerSocket.bind(ServerSocket.java:328)
    at java.net.ServerSocket.<init>(ServerSocket.java:194)
    at java.net.ServerSocket.<init>(ServerSocket.java:150)
    at org.mortbay.jetty.bio.SocketConnector.newServerSocket(SocketConnector.java:80)
    at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
    at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:283)
    at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.Server.doStart(Server.java:235)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.mortbay.start.Main.invokeMain(Main.java:194)
    at org.mortbay.start.Main.start(Main.java:534)
    at org.mortbay.start.Main.start(Main.java:441)
    at org.mortbay.start.Main.main(Main.java:119)
Jul 10, 2011 10:41:27 PM org.apache.solr.core.SolrCore registerSearcher
INFO: [] Registered new searcher Searcher@5b6b9e62 main

回答by Patricia Gorla

This means you already have an application running on that particular port.

这意味着您已经在该特定端口上运行了一个应用程序。

Run:

跑:

$ lsof -i :8983

This gives you a list of any application running on that port. In my case, Solr is already running, and I get back:

这为您提供了在该端口上运行的任何应用程序的列表。就我而言,Solr 已经在运行,我回来了:

COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    10289 patricia  111u  IPv6 399410      0t0  TCP *:8983 (LISTEN)

Kill this process by filling in your PID:

通过填写您的 PID 来终止此进程:

$ kill 10289

And then try running Solr again.

然后再次尝试运行 Solr。

回答by Ray Baxter

The java.net.BindExceptionmeans that you are attempting to restart solrwhile an earlier instance continues to run, or less probably that you have something else running on port 8983. You should find that process, kill it, and then start solragain.

java.net.BindException意味着您正在尝试solr在较早的实例继续运行时重新启动,或者不太可能在端口 8983 上运行其他程序。您应该找到该进程,将其杀死,然后重新启动solr

回答by Charith De Silva

Its bound to a some other application. In case if its a important app you can change jetty default port using following:

它绑定到某个其他应用程序。如果它是一个重要的应用程序,您可以使用以下方法更改码头默认端口:

java -Djetty.port=8181 -jar start.jar

回答by Mohamed23gharbi

ps aux  | grep solr

OR

或者

ps aux | grep start.jar

AND the get then process id and kill it:

然后获取进程 ID 并杀死它:

kill -9 #PID#

example : kill -9 4989

示例:kill -9 4989

UPDATE: after killing the process if you want to reinstall solr you soul first uninstall it, the following is one of the solutions to uninstall it:

更新:如果要重新安装 solr,请在杀死进程后先卸载它,以下是卸载它的解决方案之一:

sudo service solr stop
sudo rm -r /var/solr
sudo rm -r /opt/solr-5.3.1
sudo rm -r /opt/solr
sudo rm /etc/init.d/solr
sudo deluser --remove-home solr
sudo deluser --group solr

An now you can reinstall it with no problem.

现在您可以毫无问题地重新安装它。

回答by kenorb

If sudo lsof -i:8983won't help finding application running on the same port, the common mistake is Tomcat misconfiguration (if you're using it).

如果sudo lsof -i:8983找不到在同一端口上运行的应用程序,那么常见的错误是 Tomcat 配置错误(如果您正在使用它)。

For example by default Tomcat listens on port 8005 for SHUTDOWN command and if you set another Connector to listen on the same port, you'll get port conflict.

例如,默认情况下 Tomcat 在端口 8005 上侦听 SHUTDOWN 命令,如果您设置另一个连接器在同一端口上侦听,则会发生端口冲突。

So please double check in server.xmlif these ports are different:

因此,请仔细检查server.xml这些端口是否不同:

<Server port="8005" shutdown="SHUTDOWN">
    <Connector port="8983" protocol="HTTP/1.1"

回答by Carlos Zerga

Maybe some crazy idea is to use docker to read a complete extended step by step and repeatable installation:

也许有些疯狂的想法是使用 docker 来阅读一个完整的扩展分步和可重复安装:

Here dockerhub to select the specific version tu run in docker Docker Hub Solr

这里dockerhub选择具体的版本你在docker Docker Hub Solr中运行

And here github to read the docker recipe Solr docker Recipe

在这里github阅读docker配方Solr docker Recipe