一、基础概念
二、常用命令
1. 容器 Container (删除/停止/启动/重启)
xxxId: 表示容器 Id
# 删除容器
docker rm -f xxxId
# 设置为自动启动
docker update xxxId --restart=always
三、环境安装
1. 安装 elasticsearch
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS = "-Xms256-Xmx256" \
-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
# 启动失败可用 logs 查看报错信息
docker logs elasticsearch
报错:OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0
解决:修改 jvm.options 文件配置
find / -name 'jvm.options'
# 找到配置文件后
vim xxx/elasticsearch/jvm.options
将 -XX:+UseConcMarkSweepGC 改为 -XX:+UseG1GC
报错:Invalid initial heap size: -Xms64m-Xmx256m Error: Could not create the Java
解决:求掉 -e ES_JAVA_OPTS = “-Xms256-Xmx256” ;在 elasticsearch 配置文件中修改 -Xms 与 -Xmx 参数
2. 安装 kibana
docker run --name kibana \
-e ELASTICSEARCH_HOSTS=http://47.99.163.215:9200 \
-p 5601:5601 \
-d kibana:7.4.2
报错: Waiting for that migration to complete. If no other Kibana instance is attempting migrations, you can get past this message by deleting index .kibana2
解决:curl -XDELETE [http://localhost:9200/.kibana](http://localhost:9200/.kibana_1)2