solr 的启动命令改写
这里用 shell 重写了 solr 的启动命令
一、主从同步式
solr
# bin/sh
# chkconfig: 2345 95 20
# description: Solr Server
# Solr Server service start, stop, restart
# @author Shay Anderson 10.13
SOLR_DIR="/service/solr/ucsindex"
cur_time=`date +"%Y-%m-%d"`
JAVA="/usr/bin/java -Xmx25g -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=3 -XX:GCLogFileSize=10M -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:G1OldCSetRegionThresholdPercent=50 -XX:G1HeapWastePercent=2 -XX:G1HeapRegionSize=16m -XX:ConcGCThreads=8 -XX:ParallelGCThreads=8 -XX:MaxGCPauseMillis=20000 -XX:+PrintAdaptiveSizePolicy -XX:InitiatingHeapOccupancyPercent=0 -XX:+ParallelRefProcEnabled -Xloggc:/service/solr/logs/gc.log -server -Dcom.sun.management.jmxremote.port=9993 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DSTOP.PORT=8079 -Denable.master=false -Denable.slave=true -DSTOP.KEY=a09df7a0d -Dsolr.solr.home="/service/solr/ucsindex/ucs/" -jar /service/solr/ucsindex/start.jar"
case $1 in
start)
echo "Starting Solr..."
cd $SOLR_DIR
#$JAVA 2>&1 > $LOG_FILE &
$JAVA >/dev/null 2>&1 &
sleep 3
RETVAL=$?
if [ $RETVAL = 0 ]; then
echo "done."
else
echo "failed. See error code for more information."
fi
;;
stop)
echo "Stopping Solr..."
pkill -f start.jar >/dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Stopped"
else
echo "Failed to stop"
fi
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 [start|stop|restart]"
exit 1
;;
esac
exit 0
二、非主从同步
solr_no_slave
# bin/sh
# chkconfig: 2345 95 20
# description: Solr Server
# Solr Server service start, stop, restart
# @author Shay Anderson 10.13
SOLR_DIR="/service/solr/ucsindex"
cur_time=`date +"%Y-%m-%d"`
JAVA="/usr/bin/java -Xmx25g -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=3 -XX:GCLogFileSize=10M -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:G1OldCSetRegionThresholdPercent=50 -XX:G1HeapWastePercent=2 -XX:G1HeapRegionSize=16m -XX:ConcGCThreads=8 -XX:ParallelGCThreads=8 -XX:MaxGCPauseMillis=20000 -XX:+PrintAdaptiveSizePolicy -XX:InitiatingHeapOccupancyPercent=0 -XX:+ParallelRefProcEnabled -Xloggc:/service/solr/logs/gc.log -server -Dcom.sun.management.jmxremote.port=9993 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DSTOP.PORT=8079 -Denable.master=false -Denable.slave=false -DSTOP.KEY=a09df7a0d -Dsolr.solr.home="/service/solr/ucsindex/ucs/" -jar /service/solr/ucsindex/start.jar"
case $1 in
start)
echo "Starting Solr..."
cd $SOLR_DIR
#$JAVA 2>&1 > $LOG_FILE &
$JAVA >/dev/null 2>&1 &
sleep 3
RETVAL=$?
if [ $RETVAL = 0 ]; then
echo "done."
else
echo "failed. See error code for more information."
fi
;;
stop)
echo "Stopping Solr..."
pkill -f start.jar >/dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Stopped"
else
echo "Failed to stop"
fi
;;
restart)
$0 stop
sleep 7
$0 start
;;
*)
echo "Usage: $0 [start|stop|restart]"
exit 1
;;
esac
exit 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
上一篇: solr 的 Admin 界面
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论