环境:
OS:Centos 7
ES:6.8.5
1.查看当前的安装的插件
[root@hadoop-slave1 soft]# curl -u elastic:123456 -X GET "http://192.168.1.63:19200/_cat/plugins?v&s=component&h=name,component,version,description&pretty"
name component version description
2.将分词插件上传到相应目录并将该目录修改为es启动的用户
[root@hadoop-slave1 soft]# pwd
/soft
[root@hadoop-slave1 soft]# mkdir fenci
[root@hadoop-slave1 soft]# mv elasticsearch-analysis-ik-6.8.5.zip ./fenci/
[root@hadoop-slave1 soft]# chown -R elasticsearch:elasticsearch ./fenci/
3.切换到启动es的账号
su - elasticsearch [elasticsearch@hadoop-slave1 bin]$ cd /usr/local/services/elasticsearch/bin [elasticsearch@hadoop-slave1 bin]$ ./elasticsearch-plugin install file:///soft/fenci/elasticsearch-analysis-ik-6.8.5.zip -> Downloading file:///soft/fenci/elasticsearch-analysis-ik-6.8.5.zip [=================================================] 100%?? @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: plugin requires additional permissions @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ * java.net.SocketPermission * connect,resolve See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html for descriptions of what these permissions allow and the associated risks. Continue with installation? [y/N]y -> Installed analysis-ik [elasticsearch@hadoop-slave1 bin]$
4.验证
安装完成后plugins目录下有如下的子目录
[elasticsearch@hadoop-slave1 plugins]$ ls
analysis-ik
该目录的内容如下:
[elasticsearch@hadoop-slave1 analysis-ik]$ ls -1 commons-codec-1.9.jar commons-logging-1.2.jar elasticsearch-analysis-ik-6.8.5.jar httpclient-4.5.2.jar httpcore-4.4.4.jar plugin-descriptor.properties plugin-security.policy
同时在config目录下生成如下目录
analysis-ik
该目录的内容如下
[elasticsearch@hadoop-slave1 analysis-ik]$ ls extra_main.dic extra_single_word_low_freq.dic main.dic stopword.dic extra_single_word.dic extra_stopword.dic preposition.dic suffix.dic extra_single_word_full.dic IKAnalyzer.cfg.xml quantifier.dic surname.dic
5.再次查看分词插件是否已经安装
[elasticsearch@hadoop-slave1 analysis-ik]$ curl -u elastic:sdrdev123 -XGET 'http://192.168.1.63:19200/_cat/plugins?v&s=name'
name component version
发现是没有的,需要重启动es
[elasticsearch@hadoop-slave1 analysis-ik]$ jps
985 Jps
9355 Elasticsearch
[elasticsearch@hadoop-slave1 analysis-ik]$ kill 9355
启动
su - elasticsearch
/usr/local/services/elasticsearch/bin/elasticsearch -d
6.再次查看
[elasticsearch@hadoop-slave1 logs]$ curl -u elastic:123456 -XGET 'http://192.168.1.63:19200/_cat/plugins?v&s=name'
name component version
Jzm_fbR analysis-ik 6.8.5
从启动日志可以看到加载了分词器插件
[2024-01-18T09:38:14,453][INFO ][o.e.p.PluginsService ] [Jzm_fbR] loaded plugin [analysis-ik]