此刻我必须去/usr/java/apache-solr-1.4.0/example
然后执行以下操作:
java -jar start.jar
如何让它在启动时自动启动?
我在共享 Linux 服务器上。
当您使用共享 Linux 机器时,您可能必须要求系统管理员执行以下操作。
在中创建启动脚本/etc/init.d/solr
.
将此代码(我的 Solr 启动脚本)复制到该文件中:
#!/bin/sh
# Prerequisites:
# 1. Solr needs to be installed at /usr/local/solr/example
# 2. daemon needs to be installed
# 3. Script needs to be executed by root
# This script will launch Solr in a mode that will automatically respawn if it
# crashes. Output will be sent to /var/log/solr/solr.log. A PID file will be
# created in the standard location.
start () {
echo -n "Starting solr..."
# Start daemon
daemon --chdir='/usr/local/solr/example' --command "java -jar start.jar" --respawn --output=/var/log/solr/solr.log --name=solr --verbose
RETVAL=$?
if [ $RETVAL = 0 ]
then
echo "done."
else
echo "failed. See error code for more information."
fi
return $RETVAL
}
stop () {
# Stop daemon
echo -n "Stopping solr..."
daemon --stop --name=solr --verbose
RETVAL=$?
if [ $RETVAL = 0 ]
then
echo "Done."
else
echo "Failed. See error code for more information."
fi
return $RETVAL
}
restart () {
daemon --restart --name=solr --verbose
}
status () {
# Report on the status of the daemon
daemon --running --verbose --name=solr
return $?
}
case "$1" in
start)
start
;;
status)
status
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: solr {start|status|stop|restart}"
exit 3
;;
esac
exit $RETVAL
然后运行:
chkconfig --添加 solr
或者(在 Ubuntu 上):
update-rc.d solr 默认值
...或者,如果您的 Linux 发行版没有chkconfig
(or update-rc.d
), link /etc/init.d/solr
to /etc/rc3.d/S99solr
and /etc/rc5.d/S99solr
and /etc/rc3.d/K01solr
and /etc/rc5.d/K01solr
:
% ln -s /etc/init.d/solr /etc/rc3.d/S99solr
% ln -s /etc/init.d/solr /etc/rc5.d/S99solr
% ln -s /etc/init.d/solr /etc/rc3.d/K01solr
% ln -s /etc/init.d/solr /etc/rc5.d/K01solr
现在重新启动时,Solr 将以运行级别 3 和 5 启动(带有网络和完整的控制台)GUI).
要手动启动 solr,请运行:
% /etc/init.d/solr start
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)