使用Docker Compose启动已禁用X-Pack的Elasticsearch 5和Kibana
首先
在本地开发环境中,我想禁用Elasticsearch的X-Pack功能。
从Elasticsearch 6开始,存在一种没有安装X-Pack的elasticsearch-oss映像,而在5中不存在,因此我们将创建一个在启动时禁用或卸载了X-Pack的图像。
在本文中,我们将展示每个Compose文件的示例。
软件版本
-
- Elasticsearch 5.6.4
- Docker for Mac 17.09.0-ce-mac35
禁用X-Pack
如果在启动时要禁用的话
通过在environments中传递禁用X-Pack功能的参数来禁用它们。同时,也传递了discovery.type=single-node参数以获得单节点设置。
version: "3.3"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.4
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- xpack.graph.enabled=false
- xpack.ml.enabled=false
- xpack.monitoring.enabled=false
- xpack.security.enabled=false
- xpack.watcher.enabled=false
ports:
- "9200:9200"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es-data:/usr/share/elasticsearch/data
kibana:
image: docker.elastic.co/kibana/kibana:5.6.4
environment:
- xpack.graph.enabled=false
- xpack.ml.enabled=false
- xpack.monitoring.enabled=false
- xpack.reporting.enabled=false
- xpack.security.enabled=false
- xpack.monitoring.report_stats=false
- xpack.monitoring.ui.enabled=false
ports:
- "5601:5601"
links:
- elasticsearch:elasticsearch
volumes:
es-data:
driver: local
如果要创建卸载的映像。
创建一个Dockerfile来构建卸载了X-Pack的Elasticsearch和Kibana,并使用它们。由于我们只需要单节点配置,所以我们将在环境中传递discovery.type=single-node参数。
version: "3.3"
services:
elasticsearch:
build:
context: ./dockerfiles
dockerfile: Dockerfile-elasticsearch
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- "9200:9200"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es-data:/usr/share/elasticsearch/data
kibana:
build:
context: ./dockerfiles
dockerfile: Dockerfile-kibana
ports:
- "5601:5601"
links:
- elasticsearch:elasticsearch
volumes:
es-data:
driver: local
FROM docker.elastic.co/elasticsearch/elasticsearch:5.6.4
RUN elasticsearch-plugin remove x-pack
FROM docker.elastic.co/kibana/kibana:5.6.4
RUN kibana-plugin remove x-pack
以下是一些链接将带您进入Elasticsearch官方文档的相关页面:
1. Elasticsearch在Docker中的安装指南:https://www.elastic.co/guide/en/elasticsearch/reference/6.0/docker.html
2. 安装和启用X-Pack的指南:https://www.elastic.co/guide/en/x-pack/5.6/installing-xpack.html#xpack-enabling
3. 在Docker中以开发模式运行Elasticsearch的指南:https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html#docker-cli-run-dev-mode