快速启动SOLR

快速启动Solr脚本

这是一个用于快速启动Solr 7.2.1的shell脚本。

脚本内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

solrversion=7.2.1

if [ ! -z $1 ]; then
solrversion=$1
fi

echo "setup solr-$solrversion"

if [ -d solr-$solrversion ]; then
rm -rf solr-$solrversion
fi

wget -O solr-$solrversion.tgz http://archive.apache.org/dist/lucene/solr/$solrversion/solr-$solrversion.tgz
tar zxf solr-$solrversion.tgz
cd solr-$solrversion

bin/solr start -c -force
bin/solr create_collection -c collection1 -force
bin/post example/exampledocs/ -c collection1

echo "stopcmd:"
echo "bin/solr delete -c collection1"
echo "bin/solr stop -all"

脚本说明

功能

  • 下载指定版本的Solr(默认7.2.1)
  • 解压并启动SolrCloud模式
  • 创建collection1集合
  • 导入示例数据

使用方法

1
2
3
4
5
# 使用默认版本7.2.1
./script.sh

# 指定其他版本
./script.sh 8.11.2

停止命令

1
2
bin/solr delete -c collection1
bin/solr stop -all
© 2025 Solr Community of China All Rights Reserved. 本站访客数人次 本站总访问量
Theme by hiero