Elasticsearch安装IK分词器(docker环境下)

Elasticsearch安装IK分词器

1.下载分词器

地址:https://github.com/medcl/elasticsearch-analysis-ik/releases

1.一定是下载和自己elasticsearch版本一致的ik分词器版本

2.copy 压缩文件到docker镜像下

(1)查看镜像ID

 docker inspect -f '{{.Id}}' elasticsearch

elasticsearch-镜像名称

查看镜像ID

(2)copy分词器压缩包到docker 镜像

docker cp ./elasticsearch-analysis-ik-6.5.0.zip eaabd685e4bfafd77b5116fff67da29814a9f824b39bcd8fa3788271a1dd1533:/usr/share/elasticsearch/plugins/ik/

eaabd685e4bfafd77b5116fff67da29814a9f824b39bcd8fa3788271a1dd1533 : 容器ID
/usr/share/elasticsearch/plugins/ik/ :docker镜像中插件地址
Tip :
一定要在plugins目录下创建 ik 目录(踩坑啊)

copy分词器IK到docker

(3)进入容器解压

 进入容器
    winpty docker exec -it elasticsearch bash
 进入ik目录
    cd  /usr/share/elasticsearch/plugins/ik/
 解压
    unzip elasticsearch-analysis-ik-6.5.0.zip
 退出容器
 	exit

3.重启容器

 docker stop elasticsearch
 
 docker start elasticsearch

4.查看容器启动日志信息

docker logs -f -t —tail=1000 elasticsearch

2019-03-25T14:23:39.816489800Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [parent-join]
2019-03-25T14:23:39.816611000Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [percolator]
2019-03-25T14:23:39.816693300Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [rank-eval]
2019-03-25T14:23:39.816754700Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [reindex]
2019-03-25T14:23:39.816822000Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [repository-url]
2019-03-25T14:23:39.816888700Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [transport-netty4]
2019-03-25T14:23:39.816928200Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [tribe]
2019-03-25T14:23:39.816993500Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-ccr]
2019-03-25T14:23:39.817037000Z [2019-03-25T14:23:39,816][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-core]
2019-03-25T14:23:39.817100100Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-deprecation]
2019-03-25T14:23:39.817145700Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-graph]
2019-03-25T14:23:39.817221300Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-logstash]
2019-03-25T14:23:39.817280000Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-ml]
2019-03-25T14:23:39.817331800Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-monitoring]
2019-03-25T14:23:39.817384700Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-rollup]
2019-03-25T14:23:39.817451900Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-security]
2019-03-25T14:23:39.817498400Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-sql]
2019-03-25T14:23:39.817553400Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-upgrade]
2019-03-25T14:23:39.817606900Z [2019-03-25T14:23:39,817][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-watcher]
2019-03-25T14:23:39.818140900Z [2019-03-25T14:23:39,818][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded plugin [ingest-geoip]
2019-03-25T14:23:39.818181000Z [2019-03-25T14:23:39,818][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded plugin [ingest-user-agent]
2019-03-25T14:23:43.100407300Z [2019-03-25T14:23:43,100][INFO ][o.e.x.s.a.s.FileRolesStore] [viu6evG] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
2019-03-25T14:23:43.848286100Z [2019-03-25T14:23:43,847][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [viu6evG] [controller/72] [Main.cc@109] controller (64 bit): Version 6.5.0 (Build 71882a589e5556) Copyright (c) 2018 Elasticsearch BV
2019-03-25T14:23:44.390013700Z [2019-03-25T14:23:44,389][INFO ][o.e.d.DiscoveryModule    ] [viu6evG] using discovery type [single-node] and host providers [settings]
2019-03-25T14:23:45.084207000Z [2019-03-25T14:23:45,083][INFO ][o.e.n.Node               ] [viu6evG] initialized
2019-03-25T14:23:45.084525600Z [2019-03-25T14:23:45,084][INFO ][o.e.n.Node               ] [viu6evG] starting ...
2019-03-25T14:23:45.217022800Z [2019-03-25T14:23:45,216][INFO ][o.e.t.TransportService   ] [viu6evG] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
2019-03-25T14:23:45.290557000Z [2019-03-25T14:23:45,290][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [viu6evG] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200}
2019-03-25T14:23:45.290766600Z [2019-03-25T14:23:45,290][INFO ][o.e.n.Node               ] [viu6evG] started
2019-03-25T14:23:45.680072500Z [2019-03-25T14:23:45,679][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [viu6evG] Failed to clear cache for realms [[]]
2019-03-25T14:23:45.717164000Z [2019-03-25T14:23:45,716][INFO ][o.e.l.LicenseService     ] [viu6evG] license [56705d60-b716-4fc5-bc74-a037f23ed26e] mode [basic] - valid
2019-03-25T14:23:45.741093200Z [2019-03-25T14:23:45,740][INFO ][o.e.g.GatewayService     ] [viu6evG] recovered [0] indices into cluster_state
2019-03-25T14:24:06.336103500Z [2019-03-25T14:24:06,335][INFO ][o.e.c.m.MetaDataIndexTemplateService] [viu6evG] adding template [.management-beats] for index patterns [.management-beats]
2019-03-25T14:24:08.093626900Z [2019-03-25T14:24:08,093][INFO ][o.e.c.m.MetaDataCreateIndexService] [viu6evG] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1], mappings [doc]
2019-03-25T14:24:08.125335900Z [2019-03-25T14:24:08,125][INFO ][o.e.c.r.a.AllocationService] [viu6evG] updating number_of_replicas to [0] for indices [.kibana_1]
2019-03-25T14:24:09.027281000Z [2019-03-25T14:24:09,027][INFO ][o.e.c.r.a.AllocationService] [viu6evG] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.kibana_1][0]] ...]).
2019-03-25T14:24:09.348331600Z [2019-03-25T14:24:09,347][WARN ][o.e.d.a.a.i.t.p.PutIndexTemplateRequest] [viu6evG] Deprecated field [template] used, replaced by [index_patterns]
2019-03-25T14:24:09.358641500Z [2019-03-25T14:24:09,358][WARN ][o.e.d.a.a.i.t.p.PutIndexTemplateRequest] [viu6evG] Deprecated field [template] used, replaced by [index_patterns]
2019-03-25T14:24:09.373589600Z [2019-03-25T14:24:09,373][INFO ][o.e.c.m.MetaDataIndexTemplateService] [viu6evG] adding template [kibana_index_template:.kibana] for index patterns [.kibana]
2019-03-25T14:24:09.508865800Z [2019-03-25T14:24:09,508][INFO ][o.e.c.m.MetaDataIndexTemplateService] [viu6evG] adding template [kibana_index_template:.kibana] for index patterns [.kibana]
2019-03-25T14:24:17.355248700Z [2019-03-25T14:24:17,355][WARN ][o.e.d.a.a.i.t.p.PutIndexTemplateRequest] [viu6evG] Deprecated field [template] used, replaced by [index_patterns]
2019-03-25T14:24:17.379390500Z [2019-03-25T14:24:17,379][INFO ][o.e.c.m.MetaDataIndexTemplateService] [viu6evG] adding template [kibana_index_template:.kibana] for index patterns [.kibana]
2019-03-25T14:54:08.808173500Z [2019-03-25T14:54:08,807][INFO ][o.e.n.Node               ] [viu6evG] stopping ...
2019-03-25T14:54:08.820856900Z [2019-03-25T14:54:08,820][INFO ][o.e.x.w.WatcherService   ] [viu6evG] stopping watch service, reason [shutdown initiated]
2019-03-25T14:54:09.048776300Z [2019-03-25T14:54:09,048][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [viu6evG] [controller/72] [Main.cc@148] Ml controller exiting
2019-03-25T14:54:09.050306100Z [2019-03-25T14:54:09,050][INFO ][o.e.x.m.j.p.NativeController] [viu6evG] Native controller process has stopped - no new native processes can be started
2019-03-25T14:54:09.078355000Z [2019-03-25T14:54:09,078][INFO ][o.e.n.Node               ] [viu6evG] stopped
2019-03-25T14:54:09.078592400Z [2019-03-25T14:54:09,078][INFO ][o.e.n.Node               ] [viu6evG] closing ...
2019-03-25T14:54:09.098603100Z [2019-03-25T14:54:09,098][INFO ][o.e.n.Node               ] [viu6evG] closed
2019-03-25T14:54:35.922744200Z OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2019-03-25T14:54:37.437115800Z [2019-03-25T14:54:37,433][WARN ][o.e.c.l.LogConfigurator  ] [unknown] Some logging configurations have %marker but don't have %node_name. We will automatically add %node_name to the pattern to ease the migration for users who customize log4j2.properties but will stop this behavior in 7.0. You should manually replace `%node_name` with `[%node_name]%marker ` in these locations:
2019-03-25T14:54:37.437278500Z   /usr/share/elasticsearch/config/log4j2.properties
2019-03-25T14:54:38.049631400Z [2019-03-25T14:54:38,049][INFO ][o.e.e.NodeEnvironment    ] [viu6evG] using [1] data paths, mounts [[/ (overlay)]], net usable_space [47gb], net total_space [58.4gb], types [overlay]
2019-03-25T14:54:38.050089000Z [2019-03-25T14:54:38,049][INFO ][o.e.e.NodeEnvironment    ] [viu6evG] heap size [495.3mb], compressed ordinary object pointers [true]
2019-03-25T14:54:38.064680200Z [2019-03-25T14:54:38,064][INFO ][o.e.n.Node               ] [viu6evG] node name derived from node ID [viu6evGcRHil7wTGpNuXDA]; set [node.name] to override
2019-03-25T14:54:38.065105500Z [2019-03-25T14:54:38,064][INFO ][o.e.n.Node               ] [viu6evG] version[6.5.0], pid[1], build[default/tar/816e6f6/2018-11-09T18:58:36.352602Z], OS[Linux/4.9.125-linuxkit/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/11.0.1/11.0.1+13]
2019-03-25T14:54:38.065323400Z [2019-03-25T14:54:38,065][INFO ][o.e.n.Node               ] [viu6evG] JVM arguments [-Xms512M, -Xmx512M, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.gnsalROo, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
2019-03-25T14:54:40.337965100Z [2019-03-25T14:54:40,337][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [aggs-matrix-stats]
2019-03-25T14:54:40.337998600Z [2019-03-25T14:54:40,337][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [analysis-common]
2019-03-25T14:54:40.338059700Z [2019-03-25T14:54:40,337][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [ingest-common]
2019-03-25T14:54:40.338067700Z [2019-03-25T14:54:40,337][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [lang-expression]
2019-03-25T14:54:40.338156400Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [lang-mustache]
2019-03-25T14:54:40.338186100Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [lang-painless]
2019-03-25T14:54:40.338250000Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [mapper-extras]
2019-03-25T14:54:40.338305100Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [parent-join]
2019-03-25T14:54:40.338374300Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [percolator]
2019-03-25T14:54:40.338444700Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [rank-eval]
2019-03-25T14:54:40.338482800Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [reindex]
2019-03-25T14:54:40.338558000Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [repository-url]
2019-03-25T14:54:40.338618100Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [transport-netty4]
2019-03-25T14:54:40.338682900Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [tribe]
2019-03-25T14:54:40.338741000Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-ccr]
2019-03-25T14:54:40.338825500Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-core]
2019-03-25T14:54:40.338893600Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-deprecation]
2019-03-25T14:54:40.338944400Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-graph]
2019-03-25T14:54:40.339034800Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-logstash]
2019-03-25T14:54:40.339102700Z [2019-03-25T14:54:40,338][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-ml]
2019-03-25T14:54:40.339163800Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-monitoring]
2019-03-25T14:54:40.339227500Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-rollup]
2019-03-25T14:54:40.339292400Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-security]
2019-03-25T14:54:40.339345800Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-sql]
2019-03-25T14:54:40.339414000Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-upgrade]
2019-03-25T14:54:40.339475100Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded module [x-pack-watcher]
2019-03-25T14:54:40.339982800Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] `**loaded plugin [analysis-ik]**`
2019-03-25T14:54:40.340033300Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded plugin [ingest-geoip]
2019-03-25T14:54:40.340074100Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService     ] [viu6evG] loaded plugin [ingest-user-agent]
2019-03-25T14:54:44.004345200Z [2019-03-25T14:54:44,004][INFO ][o.e.x.s.a.s.FileRolesStore] [viu6evG] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
2019-03-25T14:54:44.607548800Z [2019-03-25T14:54:44,607][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [viu6evG] [controller/72] [Main.cc@109] controller (64 bit): Version 6.5.0 (Build 71882a589e5556) Copyright (c) 2018 Elasticsearch BV
2019-03-25T14:54:45.207279100Z [2019-03-25T14:54:45,207][INFO ][o.e.d.DiscoveryModule    ] [viu6evG] using discovery type [single-node] and host providers [settings]
2019-03-25T14:54:45.930668100Z [2019-03-25T14:54:45,930][INFO ][o.e.n.Node               ] [viu6evG] initialized
2019-03-25T14:54:45.930738900Z [2019-03-25T14:54:45,930][INFO ][o.e.n.Node               ] [viu6evG] starting ...
2019-03-25T14:54:46.055065300Z [2019-03-25T14:54:46,054][INFO ][o.e.t.TransportService   ] [viu6evG] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
2019-03-25T14:54:46.128860400Z [2019-03-25T14:54:46,128][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [viu6evG] publish_address {172.17.0.2:9200}, bound_addresses {0.0.0.0:9200}
2019-03-25T14:54:46.129771200Z [2019-03-25T14:54:46,129][INFO ][o.e.n.Node               ] [viu6evG] started
2019-03-25T14:54:46.253583300Z [2019-03-25T14:54:46,253][INFO ][o.w.a.d.Monitor          ] [viu6evG] try load config from /usr/share/elasticsearch/config/analysis-ik/IKAnalyzer.cfg.xml
2019-03-25T14:54:46.254486500Z [2019-03-25T14:54:46,254][INFO ][o.w.a.d.Monitor          ] [viu6evG] try load config from /usr/share/elasticsearch/plugins/ik/config/IKAnalyzer.cfg.xml
2019-03-25T14:54:47.058946500Z [2019-03-25T14:54:47,058][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [viu6evG] Failed to clear cache for realms [[]]
2019-03-25T14:54:47.095248300Z [2019-03-25T14:54:47,094][INFO ][o.e.l.LicenseService     ] [viu6evG] license [56705d60-b716-4fc5-bc74-a037f23ed26e] mode [basic] - valid
2019-03-25T14:54:47.116375700Z [2019-03-25T14:54:47,115][INFO ][o.e.g.GatewayService     ] [viu6evG] recovered [1] indices into cluster_state
2019-03-25T14:54:47.647361000Z [2019-03-25T14:54:47,646][INFO ][o.e.c.r.a.AllocationService] [viu6evG] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[.kibana_1][0]] ...]).

2019-03-25T14:54:40.339982800Z [2019-03-25T14:54:40,339][INFO ][o.e.p.PluginsService ] [viu6evG] loaded plugin [analysis-ik]
加载成功

5.测试下

进入kibana 查看
IK分词测试

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值