1. Preparation
Java 1.7 or greater.
> java -version
java version "1.7.0_80"
Find a right release version of SOLR for me from here http://mirror.cogentco.com/pub/apache/lucene/solr/
I download and unzip this file solr-4.10.4.tgz.
> wget http://mirror.cogentco.com/pub/apache/lucene/solr/4.10.4/solr-4.10.4.tgz
Unzip the file and place them in the working directory
> sudo ln -s /home/carl/tool/solr-4.10.4 /opt/solr-4.10.4
2. Start the Solr Server
> cd /opt/solr/example/
to Start the Solr with Jetty
> java -jar start.jar
INFO org.eclipse.jetty.server.Server – jetty-8.1.10.v20130312
INFO org.eclipse.jetty.deploy.providers.ScanningAppProvider – Deployment monitor /home/carl/tool/solr-4.10.4/example/contexts at interval 0
INFO org.eclipse.jetty.deploy.DeploymentManager – Deployable added: /home/carl/tool/solr-4.10.4/example/contexts/solr-jetty-context.xml
INFO org.eclipse.jetty.webapp.WebInfConfiguration – Extract jar:file:/home/carl/tool/solr-4.10.4/example/webapps/solr.war!/ to /home/carl/tool/solr-4.10.4/example/solr-webapp/webapp
haha, a lot of useful information,
/home/carl/tool/solr-4.10.4/example/webapps/solr.war
/home/carl/tool/solr-4.10.4/example/contexts/solr-jetty-context.xml
jetty version = jetty-8.1.10.v20130312
Then visit page http://ubuntu-pilot:8983/solr/#/, our SOLR server is up and running.
Command line can do add, update, query and etc, so the solrJ.
3. Understand of Multicore
If you have collections for Documents, People, Stocks which are completely unrelated entities.
Host unrelated entities separately so that they don’t impact each other
Having a different configuration for each core with different behavior
Performing activities on each core differently ( Update data, Load, Reload, Replication)
Keep the size of the core in check and configure caching accordingly.
When we use Command Line, we will make sure the core name is in the path.
http://host:8983/solr/core0/update ….
When we use Spring Data Solr, we have MulticoreSolrServerFactory
http://projects.spring.io/spring-data-solr/
@SolrDocument(solrCoreName=“core1”)
class Bean1 {
...
}
factory = new MulticoreSolrServerFactory(new HttpSolrServer(“http://host:8983”));
SolrServer solrServer = factory.getSolrServer(Bean1.class);
Join the Search on Multiple Cores
http://stackoverflow.com/questions/12665797/is-solr-4-0-capable-of-using-join-for-multiple-core
It will translates to something like:
SELECT b.* FROM brands b INNER JOIN products p ON b.id=p.brand_id WHERE p.name=“iPad”;
{id: “1”, name:”Apple"}
4. Clustering of SOLR
A little about SolrCores and Collections
SolrCore is essentially a single index. Multiple indexes, we should create multiple SolrCores.