How to add a new solr server
Category: OpenSolr Wiki
The question is not "HOW" but "WHY" ?
Answer: Because, that way you get the same services with this great UI and you get to use your own solr server in your prefered location !
You will need:
- Ubuntu or Debian server. Nothing else (for now).
- Public IP address for your Ubuntu server.
- Any version of SOLR installed in your server (based on your needs).
- The UnSaNe Server that comes after you have added your server with us.
If you already have a SOLR server installed and running in multicore mode, please skip to Step 2.
Step 1 - How to install SOLR from nightly build with Tomcat:
1) First of all install java from sun:
apt-get install sun-java6*
2) Download Solr from here: http://wiki.apache.org/solr/NightlyBuilds Follow those links where it says Download. You'll figure it out. Ultimately, you need the .tgz file. Not the src or anything else.
3) Install tomcat
apt-get install tomcat6
4) Untar solr:
tar -zxf apache-solr-4.0-2011-09-23_08-41-17.tgz (replace the apache-solr-4.0-2011-09-23_08-41-17.tgz with your file name)
5) Let's assume the path to the unarchived solr is: /your/solr/path (you should remember this because it's important.)
6) Now add your solr instance to Tomcat:
7) Once the VIM program is open hit the i key and paste the following (usually right-mouse-click pastes stuff in putty)
<Context docBase="/your/solr/path/example/webapps/solr.war" debug="0" crossContext="true" > <Environment name="solr/home" type="java.lang.String" value="/your/solr/path/example/multicore" override="true" /> </Context>
8) Once you have this setup please go to
9) And make sure you have some example core in there. It should be a core0 and core1 in there already.
10) Now enable the dataimporter in solrconfig.xml that's inside one of your sample cores there. (You do wanna use the dataimporter feature don't you ?) Go to step 11 :-)
11) Add the following lines to the solrconfig.xml file of one of your cores. From here-on called: your SOLR BASE CORE
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"> <lst name="defaults"> <str name="config">db-data-config.xml</str> </lst> </requestHandler>
12) Now to make the MySQL importer work you need to install the libmysql-java - Java database (JDBC) driver for MySQL
apt-get install libmysql-java
13) Now go back to the same solrconfig.xml file and tell it where it can find that libmysql library by adding this line close to the top with the other lib declarations:
<lib dir="/usr/share/java" />
14) Now make sure all other lib declarations look like this:
<lib dir="../../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
15) And make sure they do NOT have only two back-dir. We are using multicore, so we need to add one more ../
So, again: before dist there should be:
16) Now create a file db-data-config.xml in the same directory where solrconfig.xml is in your BASE CORE and fill it up with this data:
<dataConfig> <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/dbname" user="user-name" password="password"/> <document> <entity name="id" query="select id,name,desc from mytable"> </entity> </document> </dataConfig> <!-- NOTE !!! Ensure that your solr schema (schema.xml) has the fields 'id', 'name', 'desc'. Change the appropriate details in the data-config.xml -->
19) And now just create an empty file called dataimport.properties
22) And that's pretty much it. You SHOULD have a working solr with tomcat.
I'll have to be honest, I could do all this with my eyes closed while having some nice bordeaux wine
So CONTACT SUPPORT if you want me to do this (for you) with my eyes closed while having some nice bordeaux wine.
Please make sure that your BASE CORE (the one which serves as template for all other cores), will also contain the following files -among all others- (names are cAsE SeNsItIvE)
- schema.xml - the default schema.xml you want all your new collections to be based on
- schema_OK.xml - a clone of schema.xml (NOT LINK, but a physical clone)
- db-data-config.xml - the default AND VALID xml file for importing data
- db-data-config_OK.xml - a exact clone of db-data-config.xml file
- dataimport.properties - the file used for incremental data imports
Make sure all those files contain NO errors !
If you still have trouble understanding this or setting up your multicore solr server, please CONTACT SUPPORT
Step 2 - Add your server to OpenSolr.com
Let's go through the form for adding a new server:
This is just any generic name. It should however be unique throughout the entire OpenSOLR servers database. So just use your imagination and name your server.
This should be the PUBLIC IP ADDRESS of your SOLR server that you have installed in step 1.
This should be either 8983 for jetty or 8080 for Tomcat in case you haven't changed it to anything else.
This is just the word that appears after the port in the URL.
Meaning, this is usually just "solr" (without the double-quotes). So, for any SOLR instance that hasn't had it's configurations changed, this should be just solr. NO trailing slashes, NO prefixing slashes. JUST solr.
Now this is the ABSOLUTE PATH to the directory where your SOLR instance is holding all configuration files.
For example, you could most likely be:
YOU MUST remember to add a trailing slash to this path !
This is the name of the core that will serve as template for the other cores you will create in your server using Open SOLR.
So therefore, if let's say that you have your SOLR HOME DIRECTORY set to:
And inside this folder you have a core named
This means that your SOLR BASE CORE could be:
IF you are satisfied with the type of configurations that core0 has, and would like to use those configurations for every other GENERIC collection that you will be adding to your server through Open SOLR Manager.
Step 3 - Install the UnSaNe server
Now assuming you have managed to fill up the previous add-server form correctly with valid information, it is now time to DOWNLOAD and INSTALL the UnSaNe server
So after you filled up the form with valid server data, you should have a screen that will explain exactly how to install the UnSaNe server.
However, if you skipped that screen and can no longer see it, here's how you do it:
Click on the List My Servers link at the top of your Collections Manager screen, and you should get a table that looks pretty much like this:
You should now click where it says:
GENERATE & DOWNLOAD NOW
After you have downloaded the .tar.gz installer, please upload it to a path of your preference inside your Ubuntu SOLR server.
Once you have uploaded it, please run the following commands:
# Create a new directory that will hold the UnSaNe installer mkdir unsane
Now move the .tar.gz archive inside the newly created unsane directory
!!! REPLACE UnSaNe_FILE.tar.gz with the name of your archive !!!
mv UnSaNe_FILE.tar.gz unsane/UnSaNe_FILE.tar.gz
Now you have to uncompress the archive by running these two commands
!!! REPLACE UnSaNe_FILE.tar.gz with the name of your archive !!!
# Go inside the unsane folder where the file resides cd unsane # Uncompress the archive tar -zxf UnSaNe_FILE.tar.gz
Now run the installer AS ROOT !!!
# Make the installer executable sudo chmod 777 setup.unsane.sh # Run the installer AS ROOT sudo ./setup.unsane.sh
Now you should be able to add collections to YOUR OWN server !
If you still run into trouble, please CONTACT SUPPORT