-
Notifications
You must be signed in to change notification settings - Fork 0
Solr Tomcat veya Jetty Kurulumu
- rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Tomcat İle Kurulumu:
- http://openjdk.java.net/install/ yum install java-1.7.0-openjdk
- http://newpush.com/2011/10/how-to-install-tomcat-6-on-rhel-6-or-centos-6/ yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps
- wget http://ftp.itu.edu.tr/Mirror/Apache/lucene/solr/4.2.1/solr-4.2.1.tgz
- tar -xzvf solr-4.2.1.tgz
- cd solr-4.2.1
- cp -a example/solr /opt/
- cp dist/solr-4.2.1.war /opt/solr/solr.war
- chown tomcat:tomcat -R /opt/solr
Yolu ve XML Dosyası:
cat > /usr/share/tomcat6/conf/Catalina/localhost/solr.xml
<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/opt/solr/solr.war" debug="0" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/opt/solr/" override="true"/>
</Context>
chkconfig tomcat6 on && service tomcat6 restart
- service tomcat6 start
- service tomcat6 status
Not: Steps to get Solr up on Tomcat Server Install Tomcat on your machine and make sure it is ready to start. Install Solr4.0 distribution package apache-solr-4.0.0.zip and unzip it in your local directory like C:\apache-solr-4.0.0. Make a folder with name solr-home in your local machine like C:\solr-home. Go back to the solr distribution package that you downloaded C:\apache-solr-4.0.0. Have a peek inside the Examples folder. Copy all those files into the C:\solr-home folder. Look into C:\solr-home\solr and you will see two folders with name collection1 and bin, copy these two folders a step up to C:\solr-home. Look into C:\apache-solr-4.0.0\contrib\extraction in downloaded solr package and you will get a lib folder here , copy this folder to C:\solr-home. Go to C:\apache-solr-4.0.0\dist and copy apache-solr-dataimporthandler-extras-4.0.0.jar, apache-solr-dataimporthandler-4.0.0.jar and apache-solr-cell-4.0.0.jar to C:\solr-home\lib Create a file with name data-conf.xml in C:\solr-home\collection1\conf and add your database details to it like
Add this file entry to C:\solr-home\collection1\conf\solr-config.xml file like
data-config.xmlCopy apache-solr-4.0.war from C:\apache-solr-4.0.0\dist directory to webapps directory inside Tomcat. Start your Tomcat and check webapps directory having one new directory added with name solr. Look inside C:\apache-tomcat-6.0.36\webapps\solr\WEB-INF and open web.xml in a text editor, now look for an entry like this
uncomment the entry and add your solr-home path C:\solr-home to /home/javaguys/solr-home/collection1/confsolr-config.xml file under tag. Add your new libraries location to C:\solr-home\collection1\conf\solr-config.xml. just under tag like . And you are all done with it , start your server to localhost:8080/solr and you will get your solr admin panel up.
Kaynak:
- http://lucene.apache.org/solr/4_2_1/tutorial.html
- http://www.solrtutorial.com/solr-in-5-minutes.html
- http://www.mkyong.com/tomcat/tomcat-default-administrator-password/
- http://www.beingjavaguys.com/2013/01/if-you-want-to-configure-solr4.html
Jetty İle Kurulumu (Solr default olarak Jetty ile beraber geliyor.) Kaynaklar:
- http://degreesofzero.com/article/19
- http://degreesofzero.com/article/22
- http://degreesofzero.com/article/32
Önemli Notlar:
- solrconfig.xml de olarak vermek sorunsuz işlem yapmamızı sağlıyor. indirdiğiniz solr klasöründeki /lib ve /dist klasörlerini /opt/solr içine kopyalamanız gerekli. Aynı zamanda dataimport jar dosyalarını ve solr-cell dosyalarınıda aynı şekilde /lib klasörüne kopyalamalısınız.
- Dataimport class ismi ve dosyası içinde alağdaki kodu solrconfig.xml içine ekleyin.
eklenecek bölüm:
<requestHandler name="/dataimport" class="solr.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
- data-config.xml isminde bir dosya oluşturun. data import için gerekli bilgileri içine yazacaksınız.
- webden yapılacak import işlemlerinde debug seçeneği seçilmez ise full-import işlemi yapılıyor. Eğer debug seçerseniz sadece rows sayısı kadar indexleme yapılıyor.
- Birden çok kaynaktan aynı source u çekmek için data-config.xml deki içeriği çoklamak gerekiyor.
Örnek xml:
<?xml version="1.0" encoding="UTF-8"?>
<dataConfig>
<dataSource name="db1" ... />
<dataSource name="db2"... />
<document>
<entity name="outer" dataSource="db1" query=" ... ">
<field column="id" />
<entity name="inner" dataSource="db2" query=" select from ... where id = ${outer.id} ">
<field column="innercolumn" splitBy=":::" />
</entity>
</entity>
</document>
- facet için config dosyasından değişiklik yapılması gerekiyor. İçerikleri filtrelemek için kullanılıyor. İçerikleri kategorilere ayırmak için kullanılıyor.
- Data-importta eski verilerin silinmesini istiyorsak ve solr (henüz bilmiyorum bunu otomatikte yapabilir.) bunu yapsın dersek:
İki adet komut işimizi görüyor:
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>
http://localhost:8983/solr/update?stream.body=<commit/>
- cronjob ile dataimport zamanlarını ayarlayabilir ve bu işlemleri yapmasını sağlayabilirsin.