Created
September 20, 2020 21:27
-
-
Save libbkmz/bb93fd539cac512798df72efbb4bfc9c to your computer and use it in GitHub Desktop.
ElasticSearch 7.6.2 cluster with grafana, prometheus and es_exporter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.2' | |
services: | |
es01: | |
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2 | |
container_name: es01 | |
environment: | |
- node.name=es01 | |
- cluster.name=es-docker-cluster | |
- discovery.seed_hosts=es02,es03 | |
# - discovery.zen.ping.unicast.hosts=es02,es03 | |
- cluster.initial_master_nodes=es01,es02,es03 | |
- bootstrap.memory_lock=true | |
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
ulimits: | |
memlock: | |
soft: -1 | |
hard: -1 | |
volumes: | |
- data01:/usr/share/elasticsearch/data | |
ports: | |
- 9200:9200 | |
networks: | |
- elastic | |
es02: | |
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2 | |
container_name: es02 | |
environment: | |
- node.name=es02 | |
- cluster.name=es-docker-cluster | |
- discovery.seed_hosts=es01 | |
# - discovery.zen.ping.unicast.hosts=es01,es03 | |
- cluster.initial_master_nodes=es01,es02,es03 | |
- bootstrap.memory_lock=true | |
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
ulimits: | |
memlock: | |
soft: -1 | |
hard: -1 | |
volumes: | |
- data02:/usr/share/elasticsearch/data | |
networks: | |
- elastic | |
es03: | |
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2 | |
container_name: es03 | |
environment: | |
- node.name=es03 | |
- cluster.name=es-docker-cluster | |
- discovery.seed_hosts=es01 | |
# - discovery.zen.ping.unicast.hosts=es01,es02 | |
- cluster.initial_master_nodes=es01,es02,es03 | |
- bootstrap.memory_lock=true | |
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
ulimits: | |
memlock: | |
soft: -1 | |
hard: -1 | |
volumes: | |
- data03:/usr/share/elasticsearch/data | |
networks: | |
- elastic | |
# es04: | |
# image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2 | |
# container_name: es04 | |
# environment: | |
# - node.name=es04 | |
# - cluster.name=es-docker-cluster | |
# - discovery.seed_hosts=es01 | |
# - discovery.zen.ping.unicast.hosts=es01,es02 | |
# - cluster.initial_master_nodes=es01,es02,es03,es04 | |
# - bootstrap.memory_lock=true | |
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
# ulimits: | |
# memlock: | |
# soft: -1 | |
# hard: -1 | |
# volumes: | |
# - data04:/usr/share/elasticsearch/data | |
# networks: | |
# - elastic | |
elasticsearch_exporter: | |
container_name: elasticsearch_exporter | |
image: justwatch/elasticsearch_exporter:1.1.0 | |
depends_on: | |
- es01 | |
command: | |
- '--es.uri=http://es01:9200/' | |
- '--es.all' | |
- '--es.indices' | |
- '--es.shards' | |
restart: always | |
ports: | |
- 9114:9114 | |
networks: | |
- elastic | |
grafana: | |
restart: 'always' | |
ports: | |
- 3000:3000 | |
image: grafana/grafana | |
networks: | |
- elastic | |
volumes: | |
- ./grafana_data:/var/lib/grafana | |
prometheus: | |
image: prom/prometheus:latest | |
container_name: prometheus | |
restart: unless-stopped | |
volumes: | |
- ./prometheus:/etc/prometheus/ | |
- prometheus_data:/prometheus | |
command: | |
- '--config.file=/etc/prometheus/prometheus.yml' | |
- '--storage.tsdb.path=/prometheus' | |
expose: | |
- 9090 | |
ports: | |
- 9090:9090 | |
networks: | |
- elastic | |
volumes: | |
prometheus_data: {} | |
data01: | |
driver: local | |
data02: | |
driver: local | |
data03: | |
driver: local | |
# data04: | |
# driver: local | |
networks: | |
elastic: | |
driver: bridge | |
ipam: | |
driver: default | |
config: | |
- subnet: 10.10.10.0/24⏎ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my global config | |
global: | |
scrape_interval: 10s # By default, scrape targets every 15 seconds. | |
evaluation_interval: 10s # By default, scrape targets every 15 seconds. | |
# scrape_timeout is set to the global default (10s). | |
# Attach these labels to any time series or alerts when communicating with | |
# external systems (federation, remote storage, Alertmanager). | |
external_labels: | |
monitor: 'elastic-test' | |
# Load and evaluate rules in this file every 'evaluation_interval' seconds. | |
rule_files: | |
# - "alert.rules" | |
# - "first.rules" | |
# - "second.rules" | |
# A scrape configuration containing exactly one endpoint to scrape: | |
# Here it's Prometheus itself. | |
scrape_configs: | |
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. | |
- job_name: 'prometheus' | |
# Override the global default and scrape targets from this job every 5 seconds. | |
scrape_interval: 10s | |
# metrics_path defaults to '/metrics' | |
# scheme defaults to 'http'. | |
static_configs: | |
- targets: ['localhost:9090', 'elasticsearch_exporter:9114']⏎ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment