下载solr-8.2.0.zip:

wget https://archive.apache.org/dist/lucene/solr/8.2.0/solr-8.2.0.tgz

解压:

unzip solr-8.2.0.zip

进入solr-8.2.0目录:

cd solr-8.2.0

启动一个会话(session):

./bin/solr start -e cloud -force   # 官网例子没有-force参数,如果是在/root目录下操作,会提示不推荐,加-force就是不管这个提示,继续操作

以下3个问题都直接回车:
运行几个节点(默认2个),第一个节点端口(默认8983),第二个节点端口(默认7574)

To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [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]:

出现如下代码,输入​​techproducts​​,按回车:

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

这2个也直接回车 (分别是在2个节点上拆分索引,每个节点创建2个备份):

How many shards would you like to split techproducts into? [2]
How many replicas per shard would you like to create? [2]

出现如下代码: 输入​​sample_techproducts_configs​​ ,按回车:

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

然后程序开始创建,出现如下代码表示成功:

SolrCloud example running, please visit: http://localhost:8983/solr

浏览器访问地址:

​http://47.104.176.200:8983/solr/​​ (如果是外网,localhost替换为ip地址),如图:

linux安装solr(8.2.0版本)_lucene


对例子进行索引,这样就有数据了:

./bin/post -c techproducts example/exampledocs/*

浏览器访问:

​http://47.104.176.200:8983/solr/#/techproducts/query​​ 或者从solr主界面按如图操作,效果是一样的,如图:

linux安装solr(8.2.0版本)_solr_02

停止solr服务:

./bin/solr stop -all

官网solr下载列表:
​​​https://archive.apache.org/dist/lucene/solr/​

官网文档地址,更多的search例子:
​​​http://lucene.apache.org/solr/guide/8_2/solr-tutorial.html#tutorial-searching​