source: gs3-extensions/solr/trunk/src/bin/script/run_solr_server.pl@ 29711

Last change on this file since 29711 was 29711, checked in by ak19, 9 years ago

Moving from using the solr jetty server to solr using the GS3 tomcat server. Now localhost:8383/solr hosts the solr server RESTful pages. Changes: 1. Minor changes to GS3 build.xml. 2. GLI no longer does the temporary stopping of the GS3 server, launching jetty server for building a solr collection, stopping jetty, restarting GS3 tomcat server. GLI leaves the GS3 server running. 3. The main changes are to ext/solr. The ext/solr/gs3-setup.sh sets the new SOLR_PORT and SOLR_HOST variables read from the GS3 build.properties, as the jetty port and host variables are no longer used. ext/solr/build.xml now puts the solr war file into tomcat's webapps, as well as helper libraries necessary (xalan related); a solr.xml context file is created from a template file and placed into tomcat's conf/Catalina/localhost; additional solr jar files are copied into tomcat/lib, as well as the slf4j bridge being copied into GS3/web/WEB-INF/lib; the solr perl code has been changed to use the new RESTful URLs and particularly to work with solr running off the GS3 tomcat server, or stop and start it as required, rather than working with (or stopping and starting) the solr jetty server. A new run_solr_server.pl executable script runs the tomcat server rather than the jetty server; major changes to the Java Solr code to no longer work with the EmbeddedSolrServer (which caused a conflict when the index is accessed by solr jetty server upon rebuild of solr collections), our solr Java code now uses HttpSolrServer to contact the solr servlet running off tomcat. 5. Still a bug: when search results go over a page after rebuilding a solr collection in GLI against a running GS3 server, the 2nd page of search results aren't present and things break. But if the server is not running, solr collections rebuild fine, so the changes do everything that GS3.06 did and more.

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# run_solr_server.pl -- perl script that uses solrserver.pm to stop and
6# start the jetty server included with the solr extension for Greenstone3.
7# A component of the Greenstone digital library software
8# from the New Zealand Digital Library Project at the
9# University of Waikato, New Zealand.
10#
11# Copyright (C) 2012 New Zealand Digital Library Project
12#
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26#
27###########################################################################
28
29# For easily starting and stopping the jetty server (that is included with
30# the solr extension for Greenstone 3) from the command-line.
31# First source gs3-setup.sh, then this script can be run as follows:
32# run_solr_server.pl start
33# which runs the jetty server.
34# To stop the jetty server, re-run the script with the stop parameter:
35# run_solr_server.pl stop
36
37
38BEGIN {
39 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
40 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
41 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
42
43 die "GEXT_SOLR not set\n" unless defined $ENV{'GEXT_SOLR'};
44 my $solr_ext = $ENV{'GEXT_SOLR'};
45 unshift (@INC, "$solr_ext/perllib");
46}
47
48use strict;
49use util;
50#use solrutil;
51use solrserver;
52
53sub print_usage {
54 print STDERR "\nUsage:\t$0 start\n\t$0 stop\n\n";
55 exit 1;
56}
57
58sub main
59{
60 my (@argv) = @_;
61 my $argc = scalar(@argv);
62
63 # defaults and fall-backs
64 my $verbosity = 2;
65 my $command = "stop";
66 #my $stopkey = "standalone-greenstone-solr";
67
68
69 if ($argc < 1 || $argc > 2) {
70 print_usage();
71 }
72
73 if($argv[0] ne "start" && $argv[0] ne "stop") {
74 print_usage();
75 } else {
76 $command = $argv[0]
77 }
78
79 #if($argc > 1) {
80 # $stopkey = $argv[1];
81 #}
82
83 my $solr_server = new solrserver();
84 #$solr_server->set_jetty_stop_key($stopkey);
85
86 if ($command eq "start") {
87 $solr_server->start($verbosity);
88 } elsif ($command eq "stop") {
89 my $options = { 'output_verbosity' => $verbosity };
90 $solr_server->stop($options);
91 }
92}
93
94
95&main(@ARGV);
Note: See TracBrowser for help on using the repository browser.