`
sillycat
  • 浏览: 2487281 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

solr(7)4.10.4 on Jetty

 
阅读更多
solr(7)4.10.4 on Jetty

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.

Search UI
http://ubuntu-pilot:8983/solr/collection1/browse

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

{!join from=fromField to=toField fromIndex=fromCoreName}fromQuery

Have 2 cores
brands {id, name}
products {id, name, brand_id}

BRANDS: {1, Apple} {2, Alibaba} {3, Hundsun}
PRODUCTS: {1, iPhone, 1}, {2, iPad, 1} ...

http://host:8983/solr/brands/select?q=*:*&fq={!join from=brand_id to=id fromIndex=products}name:iPad

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.

Shard Cluster
https://wiki.apache.org/solr/SolrCloud
ZooKeeper + 2 Jetty Instances

Shard Cluster and Shard Replicas
https://wiki.apache.org/solr/SolrCloud

Shard Cluster with Shard Replicas and Zookeeper Ensemble
https://wiki.apache.org/solr/SolrCloud
2 shards, 2 replica and multiple zookeepers

http://blademastercoder.github.io/2015/04/18/solr-SolrCloud%20.html

That is push mode. But we are using pull mode.
https://wiki.apache.org/solr/SolrReplication

References:
http://sillycat.iteye.com/admin/blogs/2227066

http://lucene.apache.org/solr/4_10_4/tutorial.html
http://wiki.apache.org/solr/
http://wiki.apache.org/solr/CoreAdmin
http://stackoverflow.com/questions/19274590/switching-solr-cores-when-adding-documents

http://docs.ckan.org/en/latest/maintaining/solr-multicore.html

SOLR Cluster/Cloud
http://www.cnblogs.com/clarechen/p/4573290.html
http://blademastercoder.github.io/2015/04/18/solr-SolrCloud%20.html
https://wiki.apache.org/solr/SolrCloud
http://wiki.apache.org/solr/SolrJetty#MultiWebappJndi
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics