执行命令:./20.04/install_elasticsearch.sh 7 安装 Elasticsearch 后,对应版本的 IK 分词插件未安装
1、执行命令:./20.04/install_elasticsearch.sh 7 安装 Elasticsearch 后,对应版本的 IK 分词插件未安装。如图1
root@iZ2ze4fjghbbj74d4kfnf0Z:/var/www/laravel-shop# cd ~/laravel-ubuntu-init root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# ./20.04/install_elasticsearch.sh 7 ===> 正在安装 JAVA... [DONE] ===> 正在安装 Elasticsearch 7... [DONE] ===> 正在安装 Elasticsearch 插件... [DONE] 安装完毕 root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# sudo /usr/share/elasticsearch/bin/elasticsearch-plugin list root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init#
2、决定编辑 install_elasticsearch.sh,原因应该在于判断是否安装插件的代码无效。
function install_es_plugins { ESVersion=$(/usr/share/elasticsearch/bin/elasticsearch -V|awk -F',' '{print $1}'| awk '{print $2}') # [[ -e /usr/share/elasticsearch/plugins/analysis-ik ]] || { /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v${ESVersion}/elasticsearch-analysis-ik-${ESVersion}.zip # } mkdir -p /etc/elasticsearch/analysis/ touch /etc/elasticsearch/analysis/synonyms.txt service elasticsearch restart }
3、执行命令:/usr/share/elasticsearch/bin/elasticsearch-plugin list,仍然不存在对应的插件。
root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# /usr/share/elasticsearch/bin/elasticsearch-plugin list root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init#
4、最终决定手动安装插件。参考:https://github.com/medcl/elasticsearch-analysis-ik 。参考:IK version ES version 的对应关系。如图2
5、使用 elasticsearch-plugin 安装 。由于 ES version 为 7.17.6,因此 IK 可安装最新版本。报错:插件 [analysis-ik] 是为 Elasticsearch 版本 8.2.3 构建的,但版本 7.17.6 正在运行。如图3
root@iZ2ze4fjghbbj74d4kfnf0Z:~# curl 127.0.0.1:9200 { "name" : "iZ2ze4fjghbbj74d4kfnf0Z", "cluster_name" : "elasticsearch", "cluster_uuid" : "ML75WugQScOM5vF1Jeye1w", "version" : { "number" : "7.17.6", "build_flavor" : "default", "build_type" : "deb", "build_hash" : "f65e9d338dc1d07b642e14a27f338990148ee5b6", "build_date" : "2022-08-23T11:08:48.893373482Z", "build_snapshot" : false, "lucene_version" : "8.11.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } root@iZ2ze4fjghbbj74d4kfnf0Z:~# cd ~/laravel-ubuntu-init root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.2.3/elasticsearch-analysis-ik-8.2.3.zip -> Installing https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.2.3/elasticsearch-analysis-ik-8.2.3.zip -> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.2.3/elasticsearch-analysis-ik-8.2.3.zip [=================================================] 100% -> Failed installing https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.2.3/elasticsearch-analysis-ik-8.2.3.zip -> Rolling back https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.2.3/elasticsearch-analysis-ik-8.2.3.zip -> Rolled back https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.2.3/elasticsearch-analysis-ik-8.2.3.zip Exception in thread "main" java.lang.IllegalArgumentException: Plugin [analysis-ik] was built for Elasticsearch version 8.2.3 but version 7.17.6 is running at org.elasticsearch.plugins.PluginsService.verifyCompatibility(PluginsService.java:391) at org.elasticsearch.plugins.cli.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:831) at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:887) at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245) at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:88) at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) at org.elasticsearch.cli.Command.main(Command.java:77) at org.elasticsearch.plugins.cli.PluginCli.main(PluginCli.java:36) root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init#
6、决定安装 7.17.5 版本的插件。报错:插件 [analysis-ik] 是为 Elasticsearch 版本 7.17.5 构建的,但版本 7.17.6 正在运行。插件现在没有 7.17.6 版本。
root@iZ2ze4fjghbbj74d4kfnf0Z:~/laravel-ubuntu-init# /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip -> Installing https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip -> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip [=================================================] 100% -> Failed installing https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip -> Rolling back https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip -> Rolled back https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip Exception in thread "main" java.lang.IllegalArgumentException: Plugin [analysis-ik] was built for Elasticsearch version 7.17.5 but version 7.17.6 is running at org.elasticsearch.plugins.PluginsService.verifyCompatibility(PluginsService.java:391) at org.elasticsearch.plugins.cli.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:831) at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:887) at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245) at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:88) at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95) at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) at org.elasticsearch.cli.Command.main(Command.java:77) at org.elasticsearch.plugins.cli.PluginCli.main(PluginCli.java:36)
7、只有回退 Elasticsearch 版本至 7.17.5。最终决定重新来过。编辑 /20.04/install_elasticsearch.sh。指定版本为 7.17.5。如图4
function install_es { curl -sS https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - echo "deb https://mirrors.tuna.tsinghua.edu.cn/elasticstack/${VERSION}.x/apt stable main" > /etc/apt/sources.list.d/elastic-${VERSION}.x.list apt-get update apt-get install -y elasticsearch=7.17.5 service elasticsearch start }
8、Elasticsearch 版本已经为 7.17.5,且插件已经安装。如图5
root@iZ2zeh119jtszpxb8sf8pvZ:~/laravel-ubuntu-init# curl 127.0.0.1:9200 { "name" : "iZ2zeh119jtszpxb8sf8pvZ", "cluster_name" : "elasticsearch", "cluster_uuid" : "65TOsoDbTn6sWU-JSfczZg", "version" : { "number" : "7.17.5", "build_flavor" : "default", "build_type" : "deb", "build_hash" : "8d61b4f7ddf931f219e3745f295ed2bbc50c8e84", "build_date" : "2022-06-23T21:57:28.736740635Z", "build_snapshot" : false, "lucene_version" : "8.11.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } root@iZ2zeh119jtszpxb8sf8pvZ:~/laravel-ubuntu-init# sudo /usr/share/elasticsearch/bin/elasticsearch-plugin list root@iZ2zeh119jtszpxb8sf8pvZ:~/laravel-ubuntu-init# /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip -> Installing https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip -> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip [=================================================] 100% @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: plugin requires additional permissions @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ * java.net.SocketPermission * connect,resolve See https://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 -> Please restart Elasticsearch to activate any plugins installed root@iZ2zeh119jtszpxb8sf8pvZ:~/laravel-ubuntu-init# service elasticsearch restart root@iZ2zeh119jtszpxb8sf8pvZ:~/laravel-ubuntu-init# /usr/share/elasticsearch/bin/elasticsearch-plugin list analysis-ik root@iZ2zeh119jtszpxb8sf8pvZ:~/laravel-ubuntu-init#
近期评论