docker pull elasticsearch:7.17.13
docker run -d --name "容器名称" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -p 9200:9200 -p 9300:9300 elasticsearch:7.17.13
启动后使用docker logs查看ES启动日志,发现如下错误信息
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log
在Docker启动命令中加入ElasticSearch单节点启动命令
docker run -d --name "容器名称" -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 elasticsearch:7.17.13
ElasticSearch启动成功
进入ElasticSearch容器
docker exec -it "ES容器名称" /bin/bash
使用apt命令时,可能会出现如下错误:
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission)
解决方法详见:Docker容器内使用apt报错 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission)_江南烟雨゛断桥殇╮的博客-CSDN博客【代码】Docker容器内使用apt报错 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission)https://blog.csdn.net/qq_35364632/article/details/133790095
修改elasticsearch.yml文件
vim config/elasticsearch.yml
使用vim编辑文件时,可能会出现如下错误,提示bash vim:command not found
解决方法详见:解决Docker容器中,vim not found问题-CSDN博客【代码】解决Docker容器中,vim not found问题。https://blog.csdn.net/qq_35364632/article/details/133785782
加入跨域配置
http.cors.enabled: true
http.cors.allow-origin: "*"
退出并重启ES服务
exit
docker restart "ES容器名称"
访问ES服务,出现如下信息说明Elasticsearch启动成功
ik分词器装与不装都挺好,不装查到的东西也很精确够使,装上会查出一些没有用的!
Releases · medcl/elasticsearch-analysis-ik · GitHubThe IK Analysis plugin integrates Lucene IK analyzer into elasticsearch, support customized dictionary. - Releases · medcl/elasticsearch-analysis-ikhttps://github.com/medcl/elasticsearch-analysis-ik/releases
# 进入容器
docker exec -it "ES容器名称" /bin/bash
# 创建目录
mkdir plugins/ik
# 将ik分词器压缩包移动到ES容器中
docker cp /Volumes/elasticsearch-analysis-ik-7.17.6.zip "ES容器名称":/usr/share/elasticsearch/plugins/ik
# 解压ik分词器压缩包
unzip /plugins/ik/elasticsearch-analysis-ik-7.17.6.zip
# 退出
exit
# 重启es
docker restart "ES容器名称"
ElasticSearch启动报错:Plugin [analysis-ik] was built for Elasticsearch version 7.17.13 but version7.17.6_江南烟雨゛断桥殇╮的博客-CSDN博客【代码】ElasticSearch启动报错:Plugin [analysis-ik] was built for Elasticsearch version 7.17.13 but version7.17.6。https://blog.csdn.net/qq_35364632/article/details/133804540
docker pull mobz/elasticsearch-head:5-alpine
docker run -d --name "容器名称" -p 9100:9100 mobz/elasticsearch-head:5-alpine
访问ES-HEAD地址,连接ES
docker pull kibana:7.17.13
docker run -d --name "容器名称" --link "ES容器名称":elasticsearch -p 5601:5601 kibana:7.17.13
进入kibana容器
docker exec -it "kibana容器名称" /bin/bash
修改kibana.yml文件
vim config/kibana.yml
在最后一行添加语言
i18n.locale: "zh-CN"
重启kibana
docker restart "容器名称"