Solr 5.0之前都是借助于tomcat启动,5.1后可以自己是一个服务使用,不用借助于tomcat。
Solr可以运行在两种模式:“Cloud” mode or “Standalone” mode。
SolrCloud mode下,可以创建collections,而在Standalone mode下,只能创建core。
最近复现漏洞,需要Solr以SolrCloud模式启动,查阅了一些博客和资料,都是需要安装、复制tomcat、zookeeper等多种软件,甚是麻烦。
后来翻到@giserinchina 的博客《Solr学习笔记(1):Solr 8.1.0 安装(启动cloud)》,发现原来可以这样,深感知识浅薄及文档阅读能力不足,特此记录。
详细可参考:
https://blog.youkuaiyun.com/wxb880114/article/details/90407203
1、下载solr:https://archive.apache.org/dist/lucene/solr/8.1.0/solr-8.1.0.tgz
2、解压:tar -zxvf solr-8.1.0.tgz
3、启动solr,两种方式
a) standlone模式:bin/solr start 启动单机版
b) Cloud模式:bin/solr start -cloud 启动分布式版本
可以加上-force
在solr目录的bin目录下,启动solr:
solr-8.1.0/bin/solr start -e cloud -force
*** [WARN] *** Your open file limit is currently 1024.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
*** [WARN] *** Your Max Processes Limit is currently 15061.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Welcome 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
Ok, let's start up 2 Solr nodes for your example SolrCloud cluster.
Please enter the port for node1 [8983]:
Please enter the port for node2 [7574]:
Creating Solr home directory /data/soft/solr-8.1.0/example/cloud/node1/solr
Cloning /data/soft/solr-8.1.0/example/cloud/node1 into
/data/soft/solr-8.1.0/example/cloud/node2
Starting up Solr on port 8983 using command:
"/data/soft/solr-8.1.0/bin/solr" start -cloud -p 8983 -s "solr-8.1.0/example/cloud/node1/solr" -force
*** [WARN] *** Your open file limit is currently 4096.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
*** [WARN] *** Your Max Processes Limit is currently 15061.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.
Started Solr server on port 8983 (pid=19474). Happy searching!
Starting up Solr on port 7574 using command:
"/data/soft/solr-8.1.0/bin/solr" start -cloud -p 7574 -s "solr-8.1.0/example/cloud/node2/solr" -z localhost:9983 -force
*** [WARN] *** Your open file limit is currently 4096.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
*** [WARN] *** Your Max Processes Limit is currently 15061.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 7574.
Started Solr server on port 7574 (pid=19602). Happy searching!
INFO - 2020-10-14 14:06:35.435; org.apache.solr.common.cloud.ConnectionManager; zkClient has connected
INFO - 2020-10-14 14:06:35.461; org.apache.solr.common.cloud.ZkStateReader; Updated live nodes from ZooKeeper... (0) -> (2)
INFO - 2020-10-14 14:06:35.485; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 ready
Now let's create a new collection for indexing documents in your 2-node cluster.
Please provide a name for your new collection: [gettingstarted]
成功启动Solr Cloud模式