Search This Blog

Thursday, October 13, 2011

Solr 3.x and Tomcat setup tutorial

There is a good tutorial on solr's official site on Solr with jetty but I wouldn't find a good instruction on Solr with Tomat setup thats clean and easy. So here is my instruction.

1. download solr ( we are at version 3.x.x)
2. extra files    (tar -zxvf apache.solr.blabla.tar)
3. create solrHome folder
4. go to the upzipped solr directory and copy dist/apache.solr.3.x.x.war to solrHome
5. rename that file in solrHome from apache.solr.3.x.x.war to solr.war
6. download tomcat and modify server.xml as in 7
7.       <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
                <Context docBase="/home/ec2-user/sandbox/solrHome/solr.war" path="/solr" reloadable="true" unpackWAR="false">
                        <Environment name="solr/home" type="java.lang.String" value="/home/ec2-user/sandbox/solrHome/" override="true" />
                </Context>

      </Host>
8. copy folders and files below  to solrHome folder also make a folder name "data" too.
conf, example, exampledocs, start.jar
these things can be found in the solr distribution tar file downloaded.

9. test solr.
go to http://localhost:8983/solr/admin/
make sure server is up and running.

10. index the monitor data 
-data are in xml format, if we want to add more data, modify the solrconfig and schema.xml files
-to fit the new data format. this is actually very simple.

cd /home/ec2-user/sandbox/solrHome/exampledocs
user:~/solr/example/exampledocs$ java -jar post.jar solr.xml monitor.xml
make sure not error from catalina.out.

11.
http://localhost:8983/solr/browse
check interface. play with it, click it. no error.

12
index all data.
java -jar post.jar *.xml

13
http://localhost:8983/solr/browse
check interface. play with it, click it. no error. more data.

------------------
command to delete all index

java -Ddata=args -Dcommit=no -jar post.jar "<delete><query>*:*</query></delete>"

java -Ddata=args -Dcommit=no -jar post.jar "<commit/>"

java -Ddata=args -Dcommit=no -jar post.jar "<optimize/>"
---------------------

Monday, October 10, 2011

OutOfMemoryError Intellij - Tomcat

Dealing with “OutOfMemoryError” in “PermGen space”.  IntelliJ - tomcat

from the IntelliJ tool bar do the following

1. run --> edit configuration
2. select tomcat server and press the + button from the right hand panel to create tomcat instance.
3. edit vm parameter   add    -XX:MaxPermSize=512m
4. edit and configure other stuff related to your project then click "apply"
done

Saturday, October 8, 2011

Install JDK 7 on ubuntu 11

Install JDK 7 on ubuntu 11

1. download jdk binary from
http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. unzip the file (assume that the file was downloaded and saved under /home/merlin/Downloads/)

3. move the unzipped folder to /usr/lib/jvm
sudo mv /home/merlin/Downloads/jdk1.7.0/ /usr/lib/jvm/jdk1.7.0

4. find out how many jdk has been installed in the system.
sudo update-alternatives --config java

my system only had java6 installed, so the out put looks like this.

There is only one alternative in link group java: /usr/lib/jvm/java-6-openjdk/jre/bin/java
Nothing to configure.

5.  since i only had 1 installed, i'm going to install number 2 so i can pick from a list of them.
sudo update-alternatives --install /usr/bin/java java  /usr/lib/jvm/jdk1.7.0/jre/bin/java 2

-- the final number of the command is 2 meaning i'm installing second java version. if you want to install 3rd, or 4th or 5th, then the number should change accordingly eg 3, 4 or 5


6. pick your java version
sudo update-alternatives --config java

--out put from the console below


  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/jdk1.7.0/jre/bin/java         2         manual mode

0 indicates the version in use.

all you have to do now is type the number you wish to pick and hit enter

2    --- type 2 and press enter



7. test your java version

java -version

output below

java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)



done