solr init.d script

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

solr init.d script

Nikola Garafolic
Hi,

Does anyone have some kind of init.d script for solr, that can start,
stop and check solr status?

--
Nikola Garafolic
SRCE, Sveucilisni racunski centar
tel: +385 1 6165 804
email: [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: solr init.d script

Eric Martin
Er, what flavor?

RHEL / CentOS

#!/bin/sh

# Starts, stops, and restarts Apache Solr.
#
# chkconfig: 35 92 08
# description: Starts and stops Apache Solr

SOLR_DIR="/var/solr"
JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mustard -jar start.jar"
LOG_FILE="/var/log/solr.log"
JAVA="/usr/bin/java"

case $1 in
    start)
        echo "Starting Solr"
        cd $SOLR_DIR
        $JAVA $JAVA_OPTIONS 2> $LOG_FILE &
        ;;
    stop)
        echo "Stopping Solr"
        cd $SOLR_DIR
        $JAVA $JAVA_OPTIONS --stop
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}" >&2
        exit 1
        ;;
esac

________________________________


Debian

http://xdeb.org/node/1213

______________________

Ubuntu

STEPS
Type in the following command in TERMINAL to install nano text editor.
sudo apt-get install nano
Type in the following command in TERMINAL to add a new script.
sudo nano /etc/init.d/solr
TERMINAL will display a new page title "GNU nano 2.0.x".
Paste the below script in this TERMINAL window.
#!/bin/sh -e

# Starts, stops, and restarts solr

SOLR_DIR="/apache-solr-1.4.0/example"
JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"
LOG_FILE="/var/log/solr.log"
JAVA="/usr/bin/java"

case $1 in
    start)
        echo "Starting Solr"
        cd $SOLR_DIR
        $JAVA $JAVA_OPTIONS 2> $LOG_FILE &
        ;;
    stop)
        echo "Stopping Solr"
        cd $SOLR_DIR
        $JAVA $JAVA_OPTIONS --stop
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}" >&2
        exit 1
        ;;
esac
Note: In above script you might have to replace /apache-solr-1.4.0/example
with appropriate directory name.
Press CTRL-X keys.
Type in Y
When ask File Name to Write press ENTER key.
You're now back to TERMINAL command line.

Type in the following command in TERMINAL to create all the links to the
script.
sudo update-rc.d solr defaults
Type in the following command in TERMINAL to make the script executable.
sudo chmod a+rx /etc/init.d/solr
To test. Reboot your Ubuntu Server.
Wait until Ubuntu Server reboot is completed.
Wait 2 minutes for Apache Solr to startup.
Using your internet browser go to your website and try a Solr search.



-----Original Message-----
From: Nikola Garafolic [mailto:[hidden email]]
Sent: Monday, November 08, 2010 11:42 PM
To: [hidden email]
Subject: solr init.d script

Hi,

Does anyone have some kind of init.d script for solr, that can start,
stop and check solr status?

--
Nikola Garafolic
SRCE, Sveucilisni racunski centar
tel: +385 1 6165 804
email: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: solr init.d script

Nikola Garafolic
Sorry, forgot to mention, Centos.
Thanks.

I have very similar script to this Centos one and I am missing status
portion of the script.

On 11/09/2010 08:47 AM, Eric Martin wrote:

> Er, what flavor?
>
> RHEL / CentOS
>
> #!/bin/sh
>
> # Starts, stops, and restarts Apache Solr.
> #
> # chkconfig: 35 92 08
> # description: Starts and stops Apache Solr
>
> SOLR_DIR="/var/solr"
> JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mustard -jar start.jar"
> LOG_FILE="/var/log/solr.log"
> JAVA="/usr/bin/java"
>
> case $1 in
>      start)
>          echo "Starting Solr"
>          cd $SOLR_DIR
>          $JAVA $JAVA_OPTIONS 2>  $LOG_FILE&
>          ;;
>      stop)
>          echo "Stopping Solr"
>          cd $SOLR_DIR
>          $JAVA $JAVA_OPTIONS --stop
>          ;;
>      restart)
>          $0 stop
>          sleep 1
>          $0 start
>          ;;
>      *)
>          echo "Usage: $0 {start|stop|restart}">&2
>          exit 1
>          ;;
> esac
>
> ________________________________
>
>
> Debian
>
> http://xdeb.org/node/1213
>
> ______________________
>
> Ubuntu
>
> STEPS
> Type in the following command in TERMINAL to install nano text editor.
> sudo apt-get install nano
> Type in the following command in TERMINAL to add a new script.
> sudo nano /etc/init.d/solr
> TERMINAL will display a new page title "GNU nano 2.0.x".
> Paste the below script in this TERMINAL window.
> #!/bin/sh -e
>
> # Starts, stops, and restarts solr
>
> SOLR_DIR="/apache-solr-1.4.0/example"
> JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"
> LOG_FILE="/var/log/solr.log"
> JAVA="/usr/bin/java"
>
> case $1 in
>      start)
>          echo "Starting Solr"
>          cd $SOLR_DIR
>          $JAVA $JAVA_OPTIONS 2>  $LOG_FILE&
>          ;;
>      stop)
>          echo "Stopping Solr"
>          cd $SOLR_DIR
>          $JAVA $JAVA_OPTIONS --stop
>          ;;
>      restart)
>          $0 stop
>          sleep 1
>          $0 start
>          ;;
>      *)
>          echo "Usage: $0 {start|stop|restart}">&2
>          exit 1
>          ;;
> esac
> Note: In above script you might have to replace /apache-solr-1.4.0/example
> with appropriate directory name.
> Press CTRL-X keys.
> Type in Y
> When ask File Name to Write press ENTER key.
> You're now back to TERMINAL command line.
>
> Type in the following command in TERMINAL to create all the links to the
> script.
> sudo update-rc.d solr defaults
> Type in the following command in TERMINAL to make the script executable.
> sudo chmod a+rx /etc/init.d/solr
> To test. Reboot your Ubuntu Server.
> Wait until Ubuntu Server reboot is completed.
> Wait 2 minutes for Apache Solr to startup.
> Using your internet browser go to your website and try a Solr search.
>
>
>
> -----Original Message-----
> From: Nikola Garafolic [mailto:[hidden email]]
> Sent: Monday, November 08, 2010 11:42 PM
> To: [hidden email]
> Subject: solr init.d script
>
> Hi,
>
> Does anyone have some kind of init.d script for solr, that can start,
> stop and check solr status?
>


--
Nikola Garafolic
SRCE, Sveucilisni racunski centar
tel: +385 1 6165 804
email: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: solr init.d script

Israel Ekpo
In reply to this post by Eric Martin
I think it would be a better idea to load solr via a servlet container like
Tomcat and then create the init.d script for tomcat instead.

http://wiki.apache.org/solr/SolrTomcat#Installing_Tomcat_6

On Tue, Nov 9, 2010 at 2:47 AM, Eric Martin <[hidden email]> wrote:

> Er, what flavor?
>
> RHEL / CentOS
>
> #!/bin/sh
>
> # Starts, stops, and restarts Apache Solr.
> #
> # chkconfig: 35 92 08
> # description: Starts and stops Apache Solr
>
> SOLR_DIR="/var/solr"
> JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mustard -jar start.jar"
> LOG_FILE="/var/log/solr.log"
> JAVA="/usr/bin/java"
>
> case $1 in
>    start)
>        echo "Starting Solr"
>        cd $SOLR_DIR
>        $JAVA $JAVA_OPTIONS 2> $LOG_FILE &
>        ;;
>    stop)
>        echo "Stopping Solr"
>        cd $SOLR_DIR
>        $JAVA $JAVA_OPTIONS --stop
>        ;;
>    restart)
>        $0 stop
>        sleep 1
>        $0 start
>        ;;
>    *)
>        echo "Usage: $0 {start|stop|restart}" >&2
>        exit 1
>        ;;
> esac
>
> ________________________________
>
>
> Debian
>
> http://xdeb.org/node/1213
>
> ______________________
>
> Ubuntu
>
> STEPS
> Type in the following command in TERMINAL to install nano text editor.
> sudo apt-get install nano
> Type in the following command in TERMINAL to add a new script.
> sudo nano /etc/init.d/solr
> TERMINAL will display a new page title "GNU nano 2.0.x".
> Paste the below script in this TERMINAL window.
> #!/bin/sh -e
>
> # Starts, stops, and restarts solr
>
> SOLR_DIR="/apache-solr-1.4.0/example"
> JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=stopkey -jar start.jar"
> LOG_FILE="/var/log/solr.log"
> JAVA="/usr/bin/java"
>
> case $1 in
>    start)
>        echo "Starting Solr"
>        cd $SOLR_DIR
>        $JAVA $JAVA_OPTIONS 2> $LOG_FILE &
>        ;;
>    stop)
>        echo "Stopping Solr"
>        cd $SOLR_DIR
>        $JAVA $JAVA_OPTIONS --stop
>        ;;
>    restart)
>        $0 stop
>        sleep 1
>        $0 start
>        ;;
>    *)
>        echo "Usage: $0 {start|stop|restart}" >&2
>        exit 1
>        ;;
> esac
> Note: In above script you might have to replace /apache-solr-1.4.0/example
> with appropriate directory name.
> Press CTRL-X keys.
> Type in Y
> When ask File Name to Write press ENTER key.
> You're now back to TERMINAL command line.
>
> Type in the following command in TERMINAL to create all the links to the
> script.
> sudo update-rc.d solr defaults
> Type in the following command in TERMINAL to make the script executable.
> sudo chmod a+rx /etc/init.d/solr
> To test. Reboot your Ubuntu Server.
> Wait until Ubuntu Server reboot is completed.
> Wait 2 minutes for Apache Solr to startup.
> Using your internet browser go to your website and try a Solr search.
>
>
>
> -----Original Message-----
> From: Nikola Garafolic [mailto:[hidden email]]
> Sent: Monday, November 08, 2010 11:42 PM
> To: [hidden email]
> Subject: solr init.d script
>
> Hi,
>
> Does anyone have some kind of init.d script for solr, that can start,
> stop and check solr status?
>
> --
> Nikola Garafolic
> SRCE, Sveucilisni racunski centar
> tel: +385 1 6165 804
> email: [hidden email]
>
>


--
°O°
"Good Enough" is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.
http://www.israelekpo.com/
Reply | Threaded
Open this post in threaded view
|

Re: solr init.d script

Nikola Garafolic
I  have two nodes running one jboss server each and using one (single)
solr instance, thats how I run it for now.

Do you recommend running jboss with solr via servlet? Two jboss run in
load-balancing for high availability purpose.

For now it seems to be ok.

On 11/09/2010 03:17 PM, Israel Ekpo wrote:
> I think it would be a better idea to load solr via a servlet container like
> Tomcat and then create the init.d script for tomcat instead.
>
> http://wiki.apache.org/solr/SolrTomcat#Installing_Tomcat_6
>

--
Nikola Garafolic
SRCE, Sveucilisni racunski centar
tel: +385 1 6165 804
email: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: solr init.d script

Israel Ekpo
Yes.

I recommend running Solr via a servlet container.

It is much easier to manage compared to running it by itself.

On Tue, Nov 9, 2010 at 10:03 AM, Nikola Garafolic
<[hidden email]>wrote:

> I  have two nodes running one jboss server each and using one (single) solr
> instance, thats how I run it for now.
>
> Do you recommend running jboss with solr via servlet? Two jboss run in
> load-balancing for high availability purpose.
>
> For now it seems to be ok.
>
>
> On 11/09/2010 03:17 PM, Israel Ekpo wrote:
>
>> I think it would be a better idea to load solr via a servlet container
>> like
>> Tomcat and then create the init.d script for tomcat instead.
>>
>> http://wiki.apache.org/solr/SolrTomcat#Installing_Tomcat_6
>>
>>
> --
> Nikola Garafolic
> SRCE, Sveucilisni racunski centar
> tel: +385 1 6165 804
> email: [hidden email]
>



--
°O°
"Good Enough" is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.
http://www.israelekpo.com/
Reply | Threaded
Open this post in threaded view
|

Re: solr init.d script

Nikola Garafolic
On 11/09/2010 07:00 PM, Israel Ekpo wrote:
> Yes.
>
> I recommend running Solr via a servlet container.
>
> It is much easier to manage compared to running it by itself.
>
> On Tue, Nov 9, 2010 at 10:03 AM, Nikola Garafolic
> <[hidden email]>wrote:

But in my case, that would make things more complex as I see it. Two
jboss servers with solr as servlet container, and then I need the same
data dir, right? I am now running single solr instance as cluster
service, with data dir set to shared lun, that can be started on any of
two hosts.

Can you explain my benefits with two solr instances via servlet, maybe
more performance?

Regards,
Nikola

--
Nikola Garafolic
SRCE, Sveucilisni racunski centar
tel: +385 1 6165 804
email: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: solr init.d script

Lance Norskog-2
As many solrs as you want can open an index for read-only queries. If
you have a shared disk with a global file system, this could work very
well.

A note: Solr sessions are stateless. There is no reason to run JBoss
Solr in fail-over mode with session replication.

On Tue, Nov 9, 2010 at 12:25 PM, Nikola Garafolic
<[hidden email]> wrote:

> On 11/09/2010 07:00 PM, Israel Ekpo wrote:
>>
>> Yes.
>>
>> I recommend running Solr via a servlet container.
>>
>> It is much easier to manage compared to running it by itself.
>>
>> On Tue, Nov 9, 2010 at 10:03 AM, Nikola Garafolic
>> <[hidden email]>wrote:
>
> But in my case, that would make things more complex as I see it. Two jboss
> servers with solr as servlet container, and then I need the same data dir,
> right? I am now running single solr instance as cluster service, with data
> dir set to shared lun, that can be started on any of two hosts.
>
> Can you explain my benefits with two solr instances via servlet, maybe more
> performance?
>
> Regards,
> Nikola
>
> --
> Nikola Garafolic
> SRCE, Sveucilisni racunski centar
> tel: +385 1 6165 804
> email: [hidden email]
>
>
>



--
Lance Norskog
[hidden email]
Reply | Threaded
Open this post in threaded view
|

scheduling imports and heartbeats

Tri Nguyen
Hi,
 
Can I configure solr to schedule imports at a specified time (say once a day,
once an hour, etc)?
 
Also, does solr have some sort of heartbeat mechanism?
 
Thanks,
 
Tri
Reply | Threaded
Open this post in threaded view
|

Re: scheduling imports and heartbeats

Ranveer Kumar-2
You should use cron for that..

On 10 Nov 2010 08:47, "Tri Nguyen" <[hidden email]> wrote:

Hi,

Can I configure solr to schedule imports at a specified time (say once a
day,
once an hour, etc)?

Also, does solr have some sort of heartbeat mechanism?

Thanks,

Tri
Reply | Threaded
Open this post in threaded view
|

Re: scheduling imports and heartbeats

Tri Nguyen
i'm looking for another solution other than cron job.

can i configure solr to schedule imports?




________________________________
From: Ranveer Kumar <[hidden email]>
To: [hidden email]
Sent: Tue, November 9, 2010 8:13:03 PM
Subject: Re: scheduling imports and heartbeats

You should use cron for that..

On 10 Nov 2010 08:47, "Tri Nguyen" <[hidden email]> wrote:

Hi,

Can I configure solr to schedule imports at a specified time (say once a
day,
once an hour, etc)?

Also, does solr have some sort of heartbeat mechanism?

Thanks,

Tri
Reply | Threaded
Open this post in threaded view
|

Re: scheduling imports and heartbeats

Ken Stanley
In reply to this post by Tri Nguyen
On Tue, Nov 9, 2010 at 10:16 PM, Tri Nguyen <[hidden email]> wrote:

> Hi,
>
> Can I configure solr to schedule imports at a specified time (say once a day,
> once an hour, etc)?
>
> Also, does solr have some sort of heartbeat mechanism?
>
> Thanks,
>
> Tri

Tri,

If you use the DataImportHandler (DIH), you can set up a
dataimport.properties file that can be configured to import on
intervals.

http://wiki.apache.org/solr/DataImportHandler#dataimport.properties_example

As for "heartbeat", you can use the ping handler (default is
/admin/ping) to check the status of the servlet.

- Ken
Reply | Threaded
Open this post in threaded view
|

Re: scheduling imports and heartbeats

Chris Hostetter-3
In reply to this post by Tri Nguyen

: References: <[hidden email]> <001701cb7fe2$58abc660$0a035320$@com>
:     <AANLkTi=[hidden email]>
:     <[hidden email]>
:     <[hidden email]>
:     <[hidden email]>
:     <[hidden email]>
: Subject: scheduling imports and heartbeats
: In-Reply-To: <[hidden email]>

http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists

When starting a new discussion on a mailing list, please do not reply to
an existing message, instead start a fresh email.  Even if you change the
subject line of your email, other mail headers still track which thread
you replied to and your question is "hidden" in that thread and gets less
attention.   It makes following discussions in the mailing list archives
particularly difficult.
See Also:  http://en.wikipedia.org/wiki/User:DonDiego/Thread_hijacking



-Hoss
Reply | Threaded
Open this post in threaded view
|

Re: scheduling imports and heartbeats

Tri Nguyen
In reply to this post by Ken Stanley
Thanks for the tip Ken.  I tried that but don't see the importing happening when
I check up on the status.

Below is what's in my dataimport.properties.

#Wed Nov 10 11:36:28 PST 2010
metadataObject.last_index_time=2010-09-20 11\:12\:47
interval=1
port=8080
server=localhost
params=/select?qt\=/dataimport&command\=full-import&clean\=true&commit\=true
webapp=solr
id.last_index_time=2010-11-10 11\:36\:27
syncEnabled=1
last_index_time=2010-11-10 11\:36\:27



 



________________________________
From: Ken Stanley <[hidden email]>
To: [hidden email]
Sent: Wed, November 10, 2010 4:41:17 AM
Subject: Re: scheduling imports and heartbeats

On Tue, Nov 9, 2010 at 10:16 PM, Tri Nguyen <[hidden email]> wrote:

> Hi,
>
> Can I configure solr to schedule imports at a specified time (say once a day,
> once an hour, etc)?
>
> Also, does solr have some sort of heartbeat mechanism?
>
> Thanks,
>
> Tri

Tri,

If you use the DataImportHandler (DIH), you can set up a
dataimport.properties file that can be configured to import on
intervals.

http://wiki.apache.org/solr/DataImportHandler#dataimport.properties_example

As for "heartbeat", you can use the ping handler (default is
/admin/ping) to check the status of the servlet.

- Ken