Home / برپایی haystack و apache - solr 4.2.1 بر روی centos

برپایی haystack و apache - solr 4.2.1 بر روی centos


cd /opt
download from
wget http://archive.apache.org/dist/lucene/solr/4.2.1/solr-4.2.1.tgz
tar -xvf solr-4.2.1.tgz
mv /opt/solr-4.2.1 /opt/solr
mv /opt/solr/example /opt/solr/core


nano /etc/init.d/solr

paste this script:

#
# chkconfig: 2345 20 20
# short-description: Solr
# description: Startup script for Apache Solr Server
 
SOLR_DIR="/opt/solr/core"
LOG_FILE="/var/log/solr.log"
JAVA="/usr/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"
 
start() {
echo -n "Starting Solr... "
cd $SOLR_DIR
$JAVA > $LOG_FILE 2>&1 &
sleep 2
RETVAL=$?
 
    if [ $RETVAL = 0 ]
    then
        echo "done."
    else
        echo "failed. See error code for more information."
    fi
    return $RETVAL
}
 
stop() {
echo -n "Stopping Solr... "
pkill -f start.jar > /dev/null
RETVAL=$?
 
    if [ $RETVAL = 0 ]
    then
        echo "done."
    else
        echo "failed. See error code for more information."
    fi
    return $RETVAL
}
 
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: solr {start|stop|restart}"
exit 3
esac
exit $RETVAL

1
2
chmod +x /etc/init.d/solr
chkconfig --add solr


/etc/init.d/solr start

/etc/init.d/solr stop


cd path/to/django/project

python manange.py build_solr_schema >schema.xml

mv schema.xml /opt/solr/core/collection1/solr/config/schema.xml


از ادمین

http://yourdomain.com:8983/solr/ 
cd path/to/django/project


python manange.py rebuild_index





     RSS of this page