elasticsearcch配远程词库
作者:互联网
前提:安装elasticsearch,命令:
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \ -e "discovery.type=single-node" \ -v ES_JAVA_OPTS="-Xms64m -Xmx512m" \ -v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \ -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \ -d elasticsearch:7.4.2
1、先安装nginx,将nginx中的配置复制到本地,删除docker中的nginx。
1)docker run -p 80:80 --name nginx -d nginx:1.10
2)docker container cp nginx:/etc/nginx .
2、重写安装nginx
docker run -p 80:80 --name nginx \ -v /mydata/nginx/html:/usr/share/nginx/html \ -v /mydata/nginx/logs:/var/log/nginx \ -v /mydata/nginx/conf:/etc/nginx \ -d nginx:1.10
3、在/nginx/html/目录下新建文件夹es,并在目录下新建分词库fenci.txt
mkdir es vi fenci.txt
4、在elasticsearch容器的plugins中配置远程扩展词典(plugins目录同/mydata/elasticsearch/plugins/)
vi IKAnalyzer.cfg.xml
<entry key="remote_ext_dict">标签下配置自己字典的位置
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>IK Analyzer 扩展配置</comment> <!--用户可以在这里配置自己的扩展字典 --> <entry key="ext_dict"></entry> <!--用户可以在这里配置自己的扩展停止词字典--> <entry key="ext_stopwords"></entry> <!--用户可以在这里配置远程扩展字典 --> <entry key="remote_ext_dict">http://192.168.56.10/es/fenci.txt</entry> <!--用户可以在这里配置远程扩展停止词字典--> <!-- <entry key="remote_ext_stopwords">words_location</entry> --> </properties>
标签:mydata,share,elasticsearcch,nginx,elasticsearch,词库,plugins,docker,远程 来源: https://www.cnblogs.com/LLFA/p/15860287.html