https://hub.docker.com/_/elasticsearch?tab=description
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docker.html
es、kibana、ik version: 7.17.7
es
拉取镜像
docker pull elasticsearch:7.17.7
设置虚拟内存容量 elasticsearch error: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 切换到 root 用户,修改单个进程中的最大线程数
vim /etc/sysctl.conf
vm.max_map_count=655368
sysctl -p
cat /proc/sys/vm/max_map_count
创建挂载目录
sudo mkdir -p D:\opt\elasticsearch\config
sudo mkdir -p D:\opt\elasticsearch\data
sudo mkdir -p D:\opt\elasticsearch\plugins
sudo mkdir -p D:\opt\elasticsearch\logs
赋予权限
sudo chmod -R 777 /opt/elasticsearch/
ES配置文件
echo http.host: 0.0.0.0 >> /opt/elasticsearch/config/elasticsearch.yml
创建容器—运行ES
sudo docker run --name elasticsearch
-p 9200:9200 -p 9300:9300
-e "discovery.type=single-node"
-e ES_JAVA_OPTS="-Xms84m -Xmx512m"
-v D:\opt\elasticsearch\config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v D:\opt\elasticsearch\data:/usr/share/elasticsearch/data -v D:\opt\elasticsearch\plugins:/usr/share/elasticsearch/plugins -v D:\opt\elasticsearch\logs:/usr/share/elasticsearch/logs -d elasticsearch:7.17.7
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -d elasticsearch:7.17.17
###
浏览器访问 http://localhost:9200
查看 es 健康状态 http://localhost:9200/_cluster/health
kibana
拉取镜像
docker pull kibana:7.17.7
创建容器—运行kibana
docker run --name kibana -p 5601:5601 --link elasticsearch:es -e "elasticsearch.hosts=http://es:9200" -e "environment.I18N_LOCALE=zh-CN" -d kibana:7.17.7
浏览器访问 http://localhost:5601/app/dev_tools#/console
ik分词器
https://github.com/medcl/elasticsearch-analysis-ik/releases
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.7/elasticsearch-analysis-ik-7.17.7.zip
解压到 es 的 plugins 目录 unzip elasticsearch-analysis-ik-7.17.7.zip -d ik mv ik /opt/elasticsearch/plugins 重启es,测试效果
docker restart elasticsearch
可视化工具
ElasticView
作者并未提供 arm 版本,其他人有提供 mod 的 arm 版本 https://github.com/1340691923/ElasticView/issues/20
https://hub.docker.com/r/rayrliang/elastic_view/tags
docker pull rayrliang/elastic_view:latest
sudo mkdir -p /data/elastic_view/data
sudo mkdir -p /data/elastic_view/logs
docker run --name elastic_view -d \
-p 8090:8090 \
-v /data/elastic_view/data:/data \
-v /data/elastic_view/logs:/logs \
rayrliang/elastic_view
浏览器访问 http://localhost:8090/
username/password: admin