solr(7)4.10.4 on Jetty

309 篇文章 0 订阅
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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值