docker-compose.ymllinux
version: '3.1' services: solr: image: solr restart: always container_name: solr ports: - 8983:8983
進入容器添加coreweb
[root@linux zookeeper]# docker exec -it solr bash solr@eaed99eb2ede:/opt/solr/server/solr$ mkdir ik_core solr@eaed99eb2ede:/opt/solr/server/solr$ cd ik_core/ solr@eaed99eb2ede:/opt/solr/server/solr/ik_core$ mkdir data solr@eaed99eb2ede:/opt/solr/server/solr/ik_core$ cp -r ../configsets/sample_techproducts_configs/conf/ . solr@eaed99eb2ede:/opt/solr/server/solr/ik_core$ echo 'name=ik_core' > core.properties
solr@eaed99eb2ede:/opt/solr/server/solr/ik_core$ ls
conf core.properties datadocker
訪問solr adminbash
Solr 對英文提供分詞支持app
能夠看到對於中文就只能進行一個字一個字拆分,爲了支持中文分詞須要安裝ikanalyzer插件,下載ikanalyzerwebapp
[root@linux ik-analyzer]# ls
ext.dic IKAnalyzer.cfg.xml ik-analyzer-solr5-5.x.jar solr-analyzer-ik-5.1.0.jar stopword.dicspa
#複製插件
[root@linux ik-analyzer]# docker cp ./ik-analyzer-solr5-5.x.jar solr:/opt/solr/server/solr-webapp/webapp/WEB-INF/lib [root@linux ik-analyzer]# docker cp ./solr-analyzer-ik-5.1.0.jar solr:/opt/solr/server/solr-webapp/webapp/WEB-INF/lib
#複製配置文件插件
[root@linux ik-analyzer]# docker cp ./ext.dic solr:/opt/solr/server/solr-webapp/webapp/WEB-INF
[root@linux ik-analyzer]# docker cp ./stopword.dic solr:/opt/solr/server/solr-webapp/webapp/WEB-INF
[root@linux ik-analyzer]# docker cp ./IKAnalyzer.cfg.xml solr:/opt/solr/server/solr-webapp/webapp/WEB-INFrest
在容器目錄/opt/solr/server/solr/ik_core/conf,添加 managed-schema文件,該配置文件在上面下載地址內有code
#將宿主機的文件拷貝到容器;裏
docker cp ./managed-schema solr:/opt/solr/server/solr/ik_core/conf
最終的分詞結果