Former docker install and use solr

1, install solr 7.5

docker solr official website: https://hub.docker.com/_/solr/

docker pull solr:7.5.0

2, start the service solr

docker run --name my_solr -d -p 8983:8983 -t solr

2.1 Creating a library solr

Creating / var / solr / data / gettingstarted a database repository directory generated named gettingstarted in.

docker exec -it --user=solr my_solr /bin/bash create_core -c gettingstarted

Create other ways solr library, execute the following command, there are other inquiries please go to the official website.

docker run -d -P solr solr-create -c mycore


#启动 solr 后台运行
#等待solr启动后执行 solr create 创建库的命令

Superuser enter docker

 docker exec -it --user root 797a18410df1  /bin/bash

3, equipped with IK tokenizer

#更新源
apt-get update
# 下载vim 编辑器
apt-get install vim
#拷贝ik分词器的jar 包拷贝到容器WEB-INF/lib目录 ,在WEB-INF 下创建classes文件 将配置文件下方文件拷贝到classes文件中
docker cp solr-analyzer-ik-5.1.0.jar my_solr:/opt/solr-8.1.1/server/solr-webapp/webapp/WEB-INF/lib
docker cp ik-analyzer-solr5-5.x.jar my_solr:/opt/solr-8.1.1/server/solr-webapp/webapp/WEB-INF/lib

#编辑managed-schema 添加一下配置信息
     <fieldType name="text_ik" class="solr.TextField">  
        <analyzer type="index" useSmart="false" class="org.wltea.analyzer.lucene.IKAnalyzer" />
        <analyzer type="query" useSmart="true" class="org.wltea.analyzer.lucene.IKAnalyzer" />
	</fieldType> 

The resource is downloaded to the beginning of the article or click the link below  https://download.csdn.net/download/huyande123/11423827

After you configure the restart solr into its UI can be seen Ik word breaker.

Install vim command to edit the file in the docker container

Installation docker

Guess you like

Origin www.cnblogs.com/huyande/p/11241296.html