1

我想使用 upstart 命令启动我的 solr。

我用来正常启动太阳能的命令是

/usr/bin/java \
-Dsolr.solr.home=/home/justeat/work/projects/solr/apache-solr-4.0.0/example/solr \
-Djetty.port=8983 \
-Djetty.logs=/home/justeat/work/projects/solr/apache-solr-4.0.0/example/solr/logs \
-Djetty.home=/home/justeat/work/projects/solr/apache-solr-4.0.0/example \
-Djava.io.tmpdir=/tmp \
-jar /home/justeat/work/projects/solr/apache-solr-4.0.0/example/start.jar

现在,当我使用

DAEMON_OPTS="-Dsolr.solr.home=/home/bitnami/search/solr/solr-4.2.1/example/solr -Djetty.port=8983 -Djetty.logs=/home/bitnami/search/solr/solr-4.2.1/example/logs -Djetty.home=/home/bitnami/search/solr/solr-4.2.1/example -Djava.io.tmpdir=/tmp -jar /home/bitnami/search/solr/solr-4.2.1/example/start.jar"

exec /usr/bin/java ${DAEMON_OPTS} >> /var/log/log.log 2>&1

新贵工作正常。当我尝试将 start-stop-daemon 与 upstart 脚本一起使用时,solr 没有收到我发送的一些参数DAEMON_OPTS

exec start-stop-daemon \
        --start \
        --make-pidfile \
        --pidfile /var/run/solr_upstart.pid \
        --chuid $USER \
        --exec /usr/bin/java -- $DAEMON_OPTS >> /var/log/log.log 2>&1

Solr日志如下,

2014-10-23 12:32:15.878:INFO:oejs.Server:jetty-8.1.2.v20120308
2014-10-23 12:32:15.932:INFO:oejdp.ScanningAppProvider:Deployment monitor /home/justeat/work/projects/solr/apache-solr-4.0.0/example/contexts at interval 0
2014-10-23 12:32:15.946:INFO:oejd.DeploymentManager:Deployable added: /home/justeat/work/projects/solr/apache-solr-4.0.0/example/contexts/solr.xml
2014-10-23 12:32:16.056:WARN:oejx.XmlConfiguration:Config error at <Set name="tempDirectory"><Property name="jetty.home" default="."/>/solr-webapp</Set> java.lang.reflect.InvocationTargetException
2014-10-23 12:32:16.056:WARN:oejd.DeploymentManager:Unable to reach node goal: started
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:565)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:378)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:338)
    at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:291)
    at org.eclipse.jetty.deploy.providers.ContextProvider.createContextHandler(ContextProvider.java:68)
    at org.eclipse.jetty.deploy.App.getContextHandler(App.java:97)
    at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:33)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:63)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
    at org.eclipse.jetty.server.Server.doStart(Server.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1215)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1138)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:457)
    at org.eclipse.jetty.start.Main.start(Main.java:602)
    at org.eclipse.jetty.start.Main.main(Main.java:82)
Caused by: 
java.lang.IllegalArgumentException: Bad temp directory: /solr-webapp
    at org.eclipse.jetty.webapp.WebAppContext.setTempDirectory(WebAppContext.java:1098)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:565)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:378)
    at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:338)
    at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:291)
    at org.eclipse.jetty.deploy.providers.ContextProvider.createContextHandler(ContextProvider.java:68)
    at org.eclipse.jetty.deploy.App.getContextHandler(App.java:97)
    at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:33)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:63)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
    at org.eclipse.jetty.server.Server.doStart(Server.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1215)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1138)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:457)
    at org.eclipse.jetty.start.Main.start(Main.java:602)
    at org.eclipse.jetty.start.Main.main(Main.java:82)
2014-10-23 12:32:16.081:INFO:oejs.AbstractConnector:Started SocketConnector@0.0.0.0:8983
4

2 回答 2

1

我没有使用完全相同的设置,但我收到了相同的错误消息。罪魁祸首是在更改凭据后,每次启动 Solr时都会/opt/solr-5.1.0/server/webapps/solr.war提取WAR 文件。因此,对于运行 Solr 的用户,该路径必须是可写的(或者您可以更改一些配置,我猜)。/opt/solr-5.1.0/server/solr-webapp/

于 2015-05-07T13:32:34.890 回答
0

A few ideas:

  • Upstart might be silently shortening the exec stanza
  • s-s-d (start-stop-daemon) might be doing that
  • maybe you are hitting the kernel limit for number or size of options?

Best bet is to:

  • remove the --pidfile and --make-pidfile options from s-s-d's opts, they are useless with Upstart
  • remove the redirection to /var/log/log.log, just rely on Upstart to catch stdout/err
  • consider using the setuid stanza of Upstart and completely removing the s-s-d invocation
于 2014-10-24T00:00:34.663 回答