创建 es 挂载的文件夹
mkdir -p /d/elasticsearch/config mkdir -p /d/elasticsearch/data mkdir -p /d/elasticsearch/plugins
写入配置文件
echo "http.host: 0.0.0.0" >> /d/elasticsearch/config/elasticsearch.yml
安装并启动
docker run --name elasticsearch -d -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" -v /d/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /d/elasticsearch/data:/usr/share/elasticsearch/data -v /d/elasticsearch/plugins:/usr/share/elasticsearch/plugins -p 9200:9200 -p 9300:9300 elasticsearch:7.10.1
详情
docker run --name elasticsearch -d \ -e ES_JAVA_OPTS="-Xms512m -Xmx512m" \ -e "discovery.type=single-node" \ -v /d/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /d/elasticsearch/data:/usr/share/elasticsearch/data \ -v /d/elasticsearch/plugins:/usr/share/elasticsearch/plugins \ -p 9200:9200 -p 9300:9300 \ elasticsearch:7.10.1
验证是否成功
http://localhost:9200
新建 kibana 映射目录
mkdir -p /d/kibana/config/
后创建配置文件
vim /d/kibana/config/kibana.yml
# # ** THIS IS AN AUTO-GENERATED FILE ** # # Default Kibana configuration for docker target server.name: kibana server.host: "0" elasticsearch.hosts: [ "http://172.31.224.1:9200" ] xpack.monitoring.ui.container.elasticsearch.enabled: true
安装
docker run -d \ --name=kibana \ --restart=always \ -p 5601:5601 \ -v /d/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml \ kibana:7.10.1
或者
docker run -d --name kibana -e ELASTICKSEARCH_HOST="http://172.31.224.1:9200" -p 5601:5601 kibana:7.10.1
验证是否成功
http://localhost:5601
若是配置文件挂载不成功就进入容器手动更改
docker exec -it kibana bash vim /usr/share/kibana/config/kibana.yml
kibana 日志
docker logs -f kibana