solr 安装 使用 单机启动 solr云启动 编入索引 搜索索引 规则搜索

网友投稿 372 2022-09-07

solr 安装 使用 单机启动 solr云启动 编入索引 搜索索引 规则搜索

目录

​​1.下载​​

​​2.solr单机启动​​

​​3.solr云启动​​

​​索引Techproducts数据​​

​​基本搜索​​

1.下载

地址:​​solr start -p 8983

solr start -p 8983

然后打开网页​​到解压目录中​​2命令:bin/solr start -e cloud​​

不显示描述输入(​​-noprompt​​)

solr-8.0.0:$ ./bin/solr start -e cloudWelcome to the SolrCloud example!This interactive session will help you launch a SolrCloud cluster on your local workstation.To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [2]:

第一个提示询问我们要运行多少个节点。注意​​[2]​​最后一行的末尾; 这是默认的节点数。这是我们想要的这个例子

enter回车

Ok, let's start up 2 Solr nodes for your example SolrCloud cluster.Please enter the port for node1 [8983]:

这将是第一个节点运行的端口。除非您知道机器上的端口8983上还有其他东西在运行,否则也请按下此默认选项enter,如果占用会提示改改

enter回车

Please enter the port for node2 [7574]:

这是第二个节点将运行的端口。同样,除非您知道机器上的端口8983上还有其他东西在运行,否则也请按下此默认选项enter。

enter回车

Solr现在将初始化自己并开始在这两个节点上运行。

Starting up 2 Solr nodes for your example SolrCloud cluster.Creating Solr home directory /solr-8.0.0/example/cloud/node1/solrCloning /solr-8.0.0/example/cloud/node1 into /solr-8.0.0/example/cloud/node2Starting up Solr on port 8983 using command:"bin/solr" start -cloud -p 8983 -s "example/cloud/node1/solr"Waiting up to 180 seconds to see Solr running on port 8983 [\]Started Solr server on port 8983 (pid=34942). Happy searching!Starting up Solr on port 7574 using command:"bin/solr" start -cloud -p 7574 -s "example/cloud/node2/solr" -z localhost:9983Waiting up to 180 seconds to see Solr running on port 7574 [\]Started Solr server on port 7574 (pid=35036). Happy searching!INFO - 2017-07-27 12:28:02.835; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 ready

请注意,Solr的两个实例已在两个节点上启动。因为我们从SolrCloud模式开始,并且没有定义有关外部ZooKeeper集群的任何细节,所以Solr启动它自己的ZooKeeper并将两个节点连接到它。

启动完成后,系统将提示您创建用于索引数据的集合。

Now let's create a new collection for indexing documents in your 2-node cluster.Please provide a name for your new collection: [gettingstarted]

输入techproducts 按enter 回车

How many shards would you like to split techproducts into? [2]

这是询问您希望在两个节点之间拆分索引的分片数。选择“2”(默认值)意味着我们将在两个节点之间相对均匀地拆分索引

回车

How many replicas per shard would you like to create? [2]

副本是用于故障转移的索引的副本。同样,默认值“2”也可以从这里开始

回车

Please choose a configuration for the techproducts collection, available options are:_default or sample_techproducts_configs [_default]

Solr有两个配置文件样本集(称为configSet)

此时,Solr将创建集合并再次向屏幕输出它发出的命令。

输入​​sample_techproducts_configs回车 or 直接回车​​

Uploading /solr-8.0.0/server/solr/configsets/_default/conf for config techproducts to ZooKeeper at localhost:9983Connecting to ZooKeeper at localhost:9983 ...INFO - 2017-07-27 12:48:59.289; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 readyUploading /solr-8.0.0/server/solr/configsets/sample_techproducts_configs/conf for config techproducts to ZooKeeper at localhost:9983Creating new collection 'techproducts' using command: "responseHeader":{ "status":0, "QTime":5460}, "success":{ "192.168.0.110:7574_solr":{ "responseHeader":{ "status":0, "QTime":4056}, "core":"techproducts_shard1_replica_n1"}, "192.168.0.110:8983_solr":{ "responseHeader":{ "status":0, "QTime":4056}, "core":"techproducts_shard2_replica_n2"}}}Enabling auto soft-commits with maxTime 3 secs using the Config APIPOSTing request to Config API: set-property updateHandler.autoSoftCommit.maxTime to 3000SolrCloud example running, please visit: bin/post -c techproducts example/exampledocs/*

windows

C:\solr-8.0.0> java -jar -Dc=techproducts -Dauto example\exampledocs\post.jar example\exampledocs\*

您应该看到类似于以下内容的输出:

SimplePostTool version 5.0.0Posting files to [base] url auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,logPOSTing file books.csv (text/csv) to [base]POSTing file books.json (application/json) to [base]/json/docsPOSTing file gb18030-example.xml (application/xml) to [base]POSTing file hd.xml (application/xml) to [base]POSTing file ipod_other.xml (application/xml) to [base]POSTing file ipod_video.xml (application/xml) to [base]POSTing file manufacturers.xml (application/xml) to [base]POSTing file mem.xml (application/xml) to [base]POSTing file money.xml (application/xml) to [base]POSTing file monitor.xml (application/xml) to [base]POSTing file monitor2.xml (application/xml) to [base]POSTing file more_books.jsonl (application/json) to [base]/json/docsPOSTing file mp500.xml (application/xml) to [base]POSTing file post.jar (application/octet-stream) to [base]/extractPOSTing file sample.html (text/html) to [base]/extractPOSTing file sd500.xml (application/xml) to [base]POSTing file solr-word.pdf (application/pdf) to [base]/extractPOSTing file solr.xml (application/xml) to [base]POSTing file test_utf8.sh (application/octet-stream) to [base]/extractPOSTing file utf8-example.xml (application/xml) to [base]POSTing file vidcard.xml (application/xml) to [base]21 files indexed.COMMITting Solr index changes to spent: 0:00:00.822

ok

现在我们准备开始搜索了。

基本搜索

可以通过REST客户端,curl,wget,Chrome POSTMAN等以及可用于许多编程语言的本机客户端查询Solr。

Solr Adminui 搜索界面

​​ 到这里就ok了

jvm配置

-DSTOP.KEY=solrrocks-DSTOP.PORT=7983-Djava.io.tmpdir=F:\solr\solr-8.1.1\server\tmp-Djetty.home=F:\solr\solr-8.1.1\server-Djetty.host=0.0.0.0-Djetty.port=8983-Dlog4j.configurationFile=file:///F:\solr\solr-8.1.1\server\resources\log4j2.xml-Dsolr.default.confdir=F:\solr\solr-8.1.1\server\solr\configsets\_default\conf-Dsolr.install.dir=F:\solr\solr-8.1.1-Dsolr.log.dir=F:\solr\solr-8.1.1\server\logs-Dsolr.log.muteconsole-Dsolr.solr.home=F:\solr\solr-8.1.1\server\solr-Duser.timezone=UTC-XX:+AlwaysPreTouch-XX:+ParallelRefProcEnabled-XX:+PerfDisableSharedMem-XX:+PrintGCApplicationStoppedTime-XX:+PrintGCDateStamps-XX:+PrintGCDetails-XX:+PrintGCTimeStamps-XX:+PrintHeapAtGC-XX:+PrintTenuringDistribution-XX:+UseG1GC-XX:+UseGCLogFileRotation-XX:+UseLargePages-XX:GCLogFileSize=20M-XX:MaxGCPauseMillis=250-XX:NumberOfGCLogFiles=9-Xloggc:F:\solr\solr-8.1.1\server\logs\solr_gc.log-Xms512m-Xmx512m-Xss256k-verbose:gc

持续更新

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:UGC营销成为营销新趋势,品牌该如何做好UGC营销?
下一篇:spring boot 实现配置一个线程池 多线程 并发 操作实例 代码介绍 代码
相关文章

 发表评论

暂时没有评论,来抢沙发吧~