solr(7)4.10.4 on Jetty
solr(7)4.10.4onJetty
1.Preparation
Java1.7orgreater.
>java-version
javaversion"1.7.0_80"
FindarightreleaseversionofSOLRformefromherehttp://mirror.cogentco.com/pub/apache/lucene/solr/
Idownloadandunzipthisfilesolr-4.10.4.tgz.
>wgethttp://mirror.cogentco.com/pub/apache/lucene/solr/4.10.4/solr-4.10.4.tgz
Unzipthefileandplacethemintheworkingdirectory
>sudoln-s/home/carl/tool/solr-4.10.4/opt/solr-4.10.4
2.StarttheSolrServer
>cd/opt/solr/example/
toStarttheSolrwithJetty
>java-jarstart.jar
INFOorg.eclipse.jetty.server.Server–jetty-8.1.10.v20130312
INFOorg.eclipse.jetty.deploy.providers.ScanningAppProvider–Deploymentmonitor/home/carl/tool/solr-4.10.4/example/contextsatinterval0
INFOorg.eclipse.jetty.deploy.DeploymentManager–Deployableadded:/home/carl/tool/solr-4.10.4/example/contexts/solr-jetty-context.xml
INFOorg.eclipse.jetty.webapp.WebInfConfiguration–Extractjar: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,alotofusefulinformation,
/home/carl/tool/solr-4.10.4/example/webapps/solr.war
/home/carl/tool/solr-4.10.4/example/contexts/solr-jetty-context.xml
jettyversion=jetty-8.1.10.v20130312
Thenvisitpagehttp://ubuntu-pilot:8983/solr/#/,ourSOLRserverisupandrunning.
Commandlinecandoadd,update,queryandetc,sothesolrJ.
SearchUI
http://ubuntu-pilot:8983/solr/collection1/browse
3.UnderstandofMulticore
IfyouhavecollectionsforDocuments,People,Stockswhicharecompletelyunrelatedentities.
Hostunrelatedentitiesseparatelysothattheydon’timpacteachother
Havingadifferentconfigurationforeachcorewithdifferentbehavior
Performingactivitiesoneachcoredifferently(Updatedata,Load,Reload,Replication)
Keepthesizeofthecoreincheckandconfigurecachingaccordingly.
WhenweuseCommandLine,wewillmakesurethecorenameisinthepath.
http://host:8983/solr/core0/update….
WhenweuseSpringDataSolr,wehaveMulticoreSolrServerFactory
http://projects.spring.io/spring-data-solr/
@SolrDocument(solrCoreName=“core1”)
classBean1{
...
}
factory=newMulticoreSolrServerFactory(newHttpSolrServer(“http://host:8983”));
SolrServersolrServer=factory.getSolrServer(Bean1.class);
JointheSearchonMultipleCores
http://stackoverflow.com/questions/12665797/is-solr-4-0-capable-of-using-join-for-multiple-core
{!joinfrom=fromFieldto=toFieldfromIndex=fromCoreName}fromQuery
Have2cores
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={!joinfrom=brand_idto=idfromIndex=products}name:iPad
Itwilltranslatestosomethinglike:
SELECTb.*FROMbrandsbINNERJOINproductspONb.id=p.brand_idWHEREp.name=“iPad”;
{id:“1”,name:”Apple"}
4.ClusteringofSOLR
AlittleaboutSolrCoresandCollections
SolrCoreisessentiallyasingleindex.Multipleindexes,weshouldcreatemultipleSolrCores.
ShardCluster
https://wiki.apache.org/solr/SolrCloud
ZooKeeper+2JettyInstances
ShardClusterandShardReplicas
https://wiki.apache.org/solr/SolrCloud
ShardClusterwithShardReplicasandZookeeperEnsemble
https://wiki.apache.org/solr/SolrCloud
2shards,2replicaandmultiplezookeepers
http://blademastercoder.github.io/2015/04/18/solr-SolrCloud%20.html
Thatispushmode.Butweareusingpullmode.
https://wiki.apache.org/solr/SolrReplication
References:
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
SOLRCluster/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