1、下载镜像文件
#存储和检索数据
docker pull elasticsearch:7.4.2 #可视化检索数据
docker pull kibana:7.4.2
2、创建实例
1、创建数据卷映射目录及相关配置
mkdir -p /mydata/elasticsearch/config mkdir -p /mydata/elasticsearch/data echo "http.host: 0.0.0.0" >>/mydata/elasticsearch/config/elasticsearch.yml
2、运行容器 Elasticsearch
docker run --restart always --name elasticsearch -p 9200:9200 -p 9300:9300 \ -e "discovery.type=single-node" \ -e ES_JAVA_OPTS="-Xms64m -Xmx128m" \ -v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \ -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \ -d elasticsearch:7.4.2
查看Docker 启动日志
docker logs 容器id前三位/或者容器名
踩坑点一
es报错:Exception in thread “main“ SettingsException[Failed to load settings from [elasticsearch.yml]]
elasticsearch.yml 中
http.host: 0.0.0.0 分号后要空一格
踩坑点二
es:报错 "stacktrace": ["org.elasticsearch.bootstrap.StartupException: ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];",
数据卷映射目录赋予权限即可
chmod -R 777 /mydata/elasticsearch
重启容器
Docker restart 容器id前三位/或者容器名
成功安装
3、运行容器 kibana
docker run --restart always --name kibana \ -e ELASTICSEARCH_HOSTS=http://192.168.56.10:9200 -p 5601:5601 \ -d kibana:7.4.2
成功安装
标签:docker,容器,mydata,Elasticsearch,7.4,elasticsearch,Docker,安装,yml From: https://www.cnblogs.com/mangoubiubiu/p/16756786.html