├── .env ├── inventory ├── example.png ├── .gitignore ├── setup ├── index.json ├── cluster.json ├── snapshot_repository.json ├── template_rollup.json ├── slm.json ├── template_metricbeat.json ├── rollup.json ├── ilm.json └── setup.sh ├── kibana.yml ├── metricbeat ├── modules.d │ ├── docker.yml │ └── system.yml └── metricbeat.yml ├── ansible.cfg ├── Dockerfile ├── terraform.tf ├── variables.tf ├── configure.yml ├── README.md ├── docker-compose.yml └── LICENSE /.env: -------------------------------------------------------------------------------- 1 | ELASTIC_VERSION=7.9.2 2 | -------------------------------------------------------------------------------- /inventory: -------------------------------------------------------------------------------- 1 | [all] 2 | xeraa.wtf ansible_python_interpreter=/usr/bin/python3 3 | -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xeraa/scale-elasticsearch/HEAD/example.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .terraform/ 2 | 3 | *.tfstate 4 | *.tfstate.backup 5 | *.tfstate.lock.info 6 | -------------------------------------------------------------------------------- /setup/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "aliases": { 3 | "metricbeat":{ 4 | "is_write_index": true 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /setup/cluster.json: -------------------------------------------------------------------------------- 1 | { 2 | "persistent": { 3 | "indices.lifecycle.poll_interval": "5s", 4 | "slm.retention_schedule": "* * * * * ?" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /setup/snapshot_repository.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "fs", 3 | "settings": { 4 | "location": "/usr/share/elasticsearch/backup/ten_min_snapshot" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /kibana.yml: -------------------------------------------------------------------------------- 1 | server.name: kibana 2 | server.host: "0" 3 | elasticsearch.hosts: 4 | - "http://elasticsearch-hot:9200" 5 | - "http://elasticsearch-warm:9200" 6 | - "http://elasticsearch-cold:9200" 7 | -------------------------------------------------------------------------------- /metricbeat/modules.d/docker.yml: -------------------------------------------------------------------------------- 1 | - module: docker 2 | metricsets: ["container", "cpu", "diskio", "healthcheck", "info", "memory", "network"] 3 | hosts: ["unix:///var/run/docker.sock"] 4 | enabled: true 5 | period: 10s 6 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | [defaults] 2 | 3 | inventory = ./inventory 4 | 5 | # Use the YAML callback plugin 6 | stdout_callback = yaml 7 | 8 | # Use the stdout_callback when running ad-hoc commands 9 | bin_ansible_callbacks = true 10 | -------------------------------------------------------------------------------- /setup/template_rollup.json: -------------------------------------------------------------------------------- 1 | { 2 | "order": 10, 3 | "index_patterns": ["*_rollup"], 4 | "settings": { 5 | "index": { 6 | "number_of_shards" : 1, 7 | "number_of_replicas" : 0, 8 | "routing.allocation.include.size": "warm" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /setup/slm.json: -------------------------------------------------------------------------------- 1 | { 2 | "schedule": "0 0/10 * * * ?", 3 | "name": "", 4 | "repository": "my_repository", 5 | "config": { 6 | "indices": ["*"] 7 | }, 8 | "retention": { 9 | "expire_after": "30m", 10 | "max_count": 5, 11 | "min_count": 2 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /setup/template_metricbeat.json: -------------------------------------------------------------------------------- 1 | { 2 | "order": 10, 3 | "index_patterns": ["metricbeat-*"], 4 | "settings": { 5 | "index": { 6 | "number_of_shards" : 2, 7 | "number_of_replicas" : 0, 8 | "routing.allocation.include.size": "hot", 9 | "lifecycle.name": "metricbeat", 10 | "lifecycle.rollover_alias": "metricbeat" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ELASTIC_VERSION 2 | FROM docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION} 3 | 4 | # This is an ugly workaround to create a backup folder with the right permissions 5 | # If you just create it through the bind mount it would be owned by root, 6 | # which isn't writeable by the Elasticsearch process 7 | RUN mkdir /usr/share/elasticsearch/backup/ && chown elasticsearch:elasticsearch /usr/share/elasticsearch/backup/ 8 | -------------------------------------------------------------------------------- /metricbeat/modules.d/system.yml: -------------------------------------------------------------------------------- 1 | - module: system 2 | metricsets: 3 | - core 4 | - cpu 5 | - load 6 | - diskio 7 | - filesystem 8 | - fsstat 9 | - memory 10 | - network 11 | - process 12 | - socket 13 | enabled: true 14 | period: 10s 15 | processes: ['.*'] 16 | process.include_cpu_ticks: true 17 | process.cgroups.enabled: true 18 | process.include_top_n: 19 | enabled: true 20 | by_cpu: 20 21 | by_memory: 20 22 | -------------------------------------------------------------------------------- /setup/rollup.json: -------------------------------------------------------------------------------- 1 | { 2 | "index_pattern" : "metricbeat-*", 3 | "rollup_index" : "metricbeat_rollup", 4 | "cron" : "0 * * * * ?", 5 | "groups" : { 6 | "date_histogram" : { 7 | "interval" : "5m", 8 | "field" : "@timestamp", 9 | "delay" : "1m", 10 | "time_zone" : "UTC" 11 | } 12 | }, 13 | "metrics" : [ 14 | { 15 | "field" : "docker.network.in.bytes", 16 | "metrics" : [ 17 | "avg", 18 | "sum" 19 | ] 20 | }, 21 | { 22 | "field" : "docker.network.out.bytes", 23 | "metrics" : [ 24 | "avg", 25 | "sum" 26 | ] 27 | } 28 | ], 29 | "timeout" : "20s", 30 | "page_size" : 1000 31 | } 32 | -------------------------------------------------------------------------------- /metricbeat/metricbeat.yml: -------------------------------------------------------------------------------- 1 | metricbeat.config.modules: 2 | path: "${path.config}/modules.d/*.yml" 3 | reload.period: 10s 4 | reload.enabled: true 5 | 6 | 7 | processors: 8 | - add_host_metadata: ~ 9 | - add_docker_metadata: ~ 10 | 11 | 12 | monitoring.enabled: true 13 | 14 | 15 | output.elasticsearch: 16 | hosts: ["elasticsearch-hot:9200", "elasticsearch-warm:9200", "elasticsearch-cold:9200"] 17 | 18 | 19 | logging.to_files: false 20 | 21 | 22 | setup: 23 | kibana.host: "kibana:5601" 24 | template.enabled: true 25 | dashboards.enabled: true 26 | ilm: 27 | enabled: true 28 | rollover_alias: "metricbeat" 29 | pattern: "metricbeat-000000" 30 | policy_name: "metricbeat" 31 | -------------------------------------------------------------------------------- /terraform.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | # Credentials are defined in the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY 3 | region = var.region 4 | } 5 | 6 | 7 | # Create the SSH key pair 8 | resource "aws_lightsail_key_pair" "scale_key_pair" { 9 | name = "scale_key_pair" 10 | public_key = file("~/.ssh/id_rsa.pub") 11 | } 12 | 13 | 14 | # Create the instance and its DNS entries 15 | resource "aws_lightsail_instance" "scale_instance" { 16 | name = "scale_instance" 17 | availability_zone = "${var.region}a" 18 | blueprint_id = var.operating_system 19 | bundle_id = var.size 20 | key_pair_name = "scale_key_pair" 21 | depends_on = [aws_lightsail_key_pair.scale_key_pair] 22 | } 23 | resource "aws_route53_record" "apex" { 24 | zone_id = var.zone_id 25 | name = var.domain 26 | type = "A" 27 | ttl = "60" 28 | records = [aws_lightsail_instance.scale_instance.public_ip_address] 29 | } 30 | -------------------------------------------------------------------------------- /variables.tf: -------------------------------------------------------------------------------- 1 | # Default instance size 2 | # Options: nano_1_0, micro_1_0, small_1_0, medium_1_0, large_1_0 3 | # Override: -var 'size=your-size' 4 | variable "size" { 5 | default = "large_1_0" 6 | } 7 | 8 | 9 | # Default AWS region 10 | # Options: eu-central-1, eu-west-1, eu-west-2, us-east-1, us-east-2, us-west-2 for Lightsail 11 | # Override: -var 'region=your-region' 12 | variable "region" { 13 | default = "eu-west-1" 14 | } 15 | 16 | 17 | # Default domain 18 | # Options: You need to use your own domain that you've registered in Route53. 19 | # Override: -var 'domain=your-domain.com' 20 | variable "domain" { 21 | default = "xeraa.wtf" 22 | } 23 | 24 | 25 | # Zone ID of the domain, no default 26 | # Options: You should provide the Zone ID of the domain in the environment variable TF_VAR_zone_id 27 | # Override: -var 'zone_id=XXXXXXXXXXXXX' 28 | variable "zone_id" {} 29 | 30 | 31 | # Operating system on AWS Lightsail 32 | # Options: Only change this at your own risk; it will probably break things. 33 | # Override: -var 'operating_system=ubuntu_16_04' 34 | variable "operating_system" { 35 | default = "ubuntu_20_04" 36 | } 37 | -------------------------------------------------------------------------------- /setup/ilm.json: -------------------------------------------------------------------------------- 1 | { 2 | "policy" : { 3 | "phases" : { 4 | "hot" : { 5 | "actions" : { 6 | "rollover" : { 7 | "max_size" : "5mb", 8 | "max_age":"5m" 9 | }, 10 | "set_priority": { 11 | "priority": 50 12 | } 13 | } 14 | }, 15 | "warm" : { 16 | "min_age" : "5m", 17 | "actions" : { 18 | "readonly" : { }, 19 | "allocate" : { 20 | "number_of_replicas" : 0, 21 | "include" : { 22 | "size" : "warm" 23 | } 24 | }, 25 | "forcemerge": { 26 | "max_num_segments": 1 27 | }, 28 | "shrink": { 29 | "number_of_shards": 1 30 | }, 31 | "set_priority": { 32 | "priority": 25 33 | } 34 | } 35 | }, 36 | "cold" : { 37 | "min_age" : "10m", 38 | "actions" : { 39 | "allocate" : { 40 | "number_of_replicas" : 0, 41 | "include" : { 42 | "size" : "cold" 43 | } 44 | }, 45 | "freeze" : { }, 46 | "set_priority": { 47 | "priority": 0 48 | } 49 | } 50 | }, 51 | "delete" : { 52 | "min_age" : "20m", 53 | "actions" : { 54 | "wait_for_snapshot" : { 55 | "policy": "ten_min_snapshot" 56 | }, 57 | "delete" : { } 58 | } 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /setup/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | ES_URL=http://elasticsearch-hot:9200 4 | 5 | # Wait for Elasticsearch to start up before doing anything. 6 | until curl -s ${ES_URL}/_cat/health -o /dev/null; do 7 | echo Waiting for Elasticsearch... 8 | sleep 3 9 | done 10 | 11 | 12 | # Wait for Kibana to start up before doing anything. 13 | until curl -s http://kibana:5601/ -o /dev/null; do 14 | echo Waiting for Kibana... 15 | sleep 3 16 | done 17 | 18 | # Load the relevant settings for ILM 19 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/_cluster/settings -d@/opt/setup/cluster.json 20 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/_ilm/policy/metricbeat -d@/opt/setup/ilm.json 21 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/_template/metricbeat-custom -d@/opt/setup/template_metricbeat.json 22 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/metricbeat-000000 -d@/opt/setup/index.json 23 | 24 | # Load the relevant settings for SLM 25 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/_snapshot/my_repository -d@/opt/setup/snapshot_repository.json 26 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/_slm/policy/ten_min_snapshot -d@/opt/setup/slm.json 27 | 28 | # Load the relevant settings for Rollups 29 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/_template/rollup -d@/opt/setup/template_rollup.json 30 | sleep 5m # Wait until (hopefully) there is Metricbeat data, which is needed to target fields in the rollup 31 | curl -s -H 'Content-Type: application/json' -XPUT ${ES_URL}/_rollup/job/metricbeat -d@/opt/setup/rollup.json 32 | curl -s -H 'Content-Type: application/json' -XPOST ${ES_URL}/_rollup/job/metricbeat/_start 33 | -------------------------------------------------------------------------------- /configure.yml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | remote_user: ubuntu 3 | become: true 4 | gather_facts: yes 5 | 6 | 7 | vars: 8 | stack_version: 7.9.2 9 | ubuntu_version: bionic 10 | 11 | 12 | pre_tasks: 13 | - name: Install Python2 to make Ansible work 14 | raw: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get -y install python2-minimal 15 | 16 | 17 | tasks: 18 | 19 | - name: Update and upgrade apt packages 20 | apt: 21 | upgrade: dist 22 | force_apt_get: yes 23 | 24 | - name: Change the mmap to a reasonable size 25 | shell: sysctl -w vm.max_map_count=262144 26 | 27 | - name: Install some developer tools 28 | apt: 29 | name: 30 | - ntp 31 | - ntpdate 32 | - python3-pip 33 | - apt-transport-https 34 | - ca-certificates 35 | - software-properties-common 36 | - whois 37 | force_apt_get: yes 38 | 39 | - name: Install Ansible dependencies 40 | pip: 41 | name: docker 42 | 43 | - name: Install Docker's fingerprint 44 | apt_key: 45 | id: 0EBFCD88 46 | url: https://download.docker.com/linux/ubuntu/gpg 47 | state: present 48 | 49 | - name: Install Docker's repository 50 | apt_repository: 51 | repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ubuntu_version }} stable 52 | state: present 53 | 54 | - name: Install Docker's binaries 55 | apt: 56 | name: 57 | - docker-ce 58 | - docker-ce-cli 59 | - docker-compose 60 | force_apt_get: yes 61 | 62 | - name: Start and enable the Docker service 63 | service: 64 | name: docker 65 | state: started 66 | enabled: yes 67 | 68 | - name: Fetch the Elastic Docker images for later use 69 | docker_image: 70 | name: "{{ item }}" 71 | source: pull 72 | with_items: 73 | - "docker.elastic.co/elasticsearch/elasticsearch:{{ stack_version }}" 74 | - "docker.elastic.co/kibana/kibana:{{ stack_version }}" 75 | - "docker.elastic.co/beats/metricbeat:{{ stack_version }}" 76 | 77 | - name: Create a directory for the demo 78 | file: 79 | path: /opt/scale-elasticsearch/ 80 | state: directory 81 | mode: '0755' 82 | 83 | - name: Provide the Metricbeat configuration 84 | copy: 85 | src: metricbeat/ 86 | dest: /opt/scale-elasticsearch/metricbeat/ 87 | mode: '0755' 88 | 89 | - name: Provide the setup 90 | copy: 91 | src: setup/ 92 | dest: /opt/scale-elasticsearch/setup/ 93 | mode: '0755' 94 | 95 | - name: Provide the Docker configuration 96 | copy: "src={{ item }} dest=/opt/scale-elasticsearch/ mode='0755'" 97 | loop: 98 | - .env 99 | - docker-compose.yml 100 | - Dockerfile 101 | - kibana.yml 102 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Scale Your Elasticsearch Cluster 2 | 3 | Demo code for the [Scale Your Elasticsearch Cluster](https://speakerdeck.com/xeraa/scale-your-elasticsearch-cluster) talk. 4 | 5 | **The settings used here are for a short lived demo only. Do not use those for any development or production environments.** 6 | 7 | 8 | ## Features 9 | 10 | ![](example.png) 11 | 12 | Start with a `docker-compose up` and explain the different parts while it is initializing. 13 | 14 | 15 | ### Index Lifecycle Management (ILM) 16 | 17 | Explain how `node.attr.size` is tying the architecture together. Show both *setup/templace_metricbeat.json* and *setup/ilm.json*, explain what is going on, and show the results in Index Management. Also load the ILM configuration in the Kibana UI, but explain why not all values are shown correctly. And you can also check the current state of an index with `GET /metricbeat-00000/_ilm/explain`. 18 | 19 | 20 | ### Snapshot Lifecycle Management (SLM) 21 | 22 | Explain how to set up the snapshot repository with *setup/snapshot_repository.json* and the policy with *setup/slm.json*. If the audience is interested in Docker details, point to the custom *Dockerfile* and why you need to create and chown the bind mounted folder, since it would be owned by root otherwise and Elasticsearch couldn't write to it. 23 | 24 | 25 | ### Frozen Index 26 | 27 | Trying out frozen indices including the recommended steps to use: 28 | 29 | ```bash 30 | PUT frozen 31 | { 32 | "settings": { 33 | "index.routing.allocation.include.size": "cold", 34 | "index.number_of_replicas" : 0 35 | } 36 | } 37 | 38 | POST frozen/_doc 39 | { 40 | "name": "Philipp" 41 | } 42 | POST frozen/_doc 43 | { 44 | "name": "Nicolas" 45 | } 46 | 47 | GET frozen/_search 48 | 49 | POST frozen/_forcemerge?max_num_segments=1 50 | 51 | POST frozen/_freeze 52 | 53 | GET frozen/_search 54 | 55 | GET frozen/_search?ignore_throttled=false 56 | 57 | GET _cat/indices/frozen?v&h=health,status,index,pri,rep,docs.count,store.size 58 | 59 | GET _cat/thread_pool/search_throttled?v&h=node_name,name,active,rejected,queue,completed&s=node_name 60 | 61 | GET frozen/_search?ignore_throttled=false&pre_filter_shard_size=1 62 | 63 | POST frozen/_doc 64 | { 65 | "name": "Abdon" 66 | } 67 | 68 | GET frozen/_settings?flat_settings=true 69 | 70 | POST frozen/_unfreeze 71 | 72 | POST frozen/_doc 73 | { 74 | "name": "Abdon" 75 | } 76 | 77 | GET frozen/_search 78 | ``` 79 | 80 | Show in *Discover* how the frozen indices are not shown by default and that you need to turn them on in the Kibana settings. 81 | 82 | 83 | ### Rollup 84 | 85 | Show the underlying *setup/rollup.json* and how you would build it in the Kibana UI. Show the underlying documents in Discover and build a visualization on the Docker network traffic. 86 | 87 | 88 | ### Cleanup 89 | 90 | Run `docker-compose down -v` to remove of the entire setup again. 91 | 92 | 93 | 94 | ## On Cloud 95 | 96 | If running this demo on Zoom or another platform that eats all your CPU, you might want to run the demo on the Cloud. 97 | 98 | 1. Have your AWS account set up, access key created, and added as environment variables in `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. Protip: Use [https://github.com/sorah/envchain](https://github.com/sorah/envchain) to keep your environment variables safe. 99 | 1. Change the settings to a domain you have registered under Route53 in *inventory* and *variables.tf*. Set the Hosted Zone for that domain and export the Zone ID under the environment variable `TF_VAR_zone_id`. If you haven't created the Hosted Zone yet, you should set it up in the AWS Console first and then set the environment variable. 100 | 1. If you haven't installed the AWS plugin for Terraform, get it with `terraform init` first. Then create the keypair, DNS settings, and instances with `terraform apply`. 101 | 1. Open and TCP/5601 on the network configuration (waiting for this [Terraform issue](https://github.com/terraform-providers/terraform-provider-aws/issues/700)). 102 | 1. Apply the configuration to the instance with `ansible-playbook configure.yml`. 103 | 104 | When you are done, remove the instances, DNS settings, and key with `terraform destroy`. 105 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | elasticsearch-hot: 4 | container_name: elasticsearch-hot 5 | build: 6 | dockerfile: ./Dockerfile 7 | context: . 8 | args: 9 | - ELASTIC_VERSION=${ELASTIC_VERSION} 10 | image: elasticsearch-scale:$ELASTIC_VERSION 11 | environment: 12 | - cluster.name=metrics-cluster 13 | - node.name=elasticsearch-hot 14 | - node.attr.size=hot 15 | - bootstrap.memory_lock=true 16 | - ES_JAVA_OPTS=-Xms512m -Xmx512m 17 | - discovery.seed_hosts=elasticsearch-warm,elasticsearch-cold 18 | - cluster.initial_master_nodes=elasticsearch-hot,elasticsearch-warm,elasticsearch-cold 19 | - xpack.monitoring.collection.enabled=true 20 | - path.repo=/usr/share/elasticsearch/backup 21 | ulimits: 22 | memlock: 23 | soft: -1 24 | hard: -1 25 | mem_limit: 1g 26 | volumes: 27 | - elasticsearch_data_hot:/usr/share/elasticsearch/data 28 | - elasticsearch_backup:/usr/share/elasticsearch/backup 29 | ports: 30 | - 9200:9200 31 | networks: 32 | - esnet 33 | 34 | elasticsearch-warm: 35 | container_name: elasticsearch-warm 36 | build: 37 | dockerfile: ./Dockerfile 38 | context: . 39 | args: 40 | - ELASTIC_VERSION=${ELASTIC_VERSION} 41 | image: elasticsearch-scale:$ELASTIC_VERSION 42 | environment: 43 | - cluster.name=metrics-cluster 44 | - node.name=elasticsearch-warm 45 | - node.attr.size=warm 46 | - bootstrap.memory_lock=true 47 | - ES_JAVA_OPTS=-Xms512m -Xmx512m 48 | - discovery.seed_hosts=elasticsearch-hot,elasticsearch-cold 49 | - cluster.initial_master_nodes=elasticsearch-hot,elasticsearch-warm,elasticsearch-cold 50 | - xpack.monitoring.collection.enabled=true 51 | - path.repo=/usr/share/elasticsearch/backup 52 | ulimits: 53 | memlock: 54 | soft: -1 55 | hard: -1 56 | mem_limit: 1g 57 | volumes: 58 | - elasticsearch_data_warm:/usr/share/elasticsearch/data 59 | - elasticsearch_backup:/usr/share/elasticsearch/backup 60 | ports: 61 | - 9201:9200 62 | networks: 63 | - esnet 64 | 65 | elasticsearch-cold: 66 | container_name: elasticsearch-cold 67 | build: 68 | dockerfile: ./Dockerfile 69 | context: . 70 | args: 71 | - ELASTIC_VERSION=${ELASTIC_VERSION} 72 | image: elasticsearch-scale:$ELASTIC_VERSION 73 | environment: 74 | - cluster.name=metrics-cluster 75 | - node.name=elasticsearch-cold 76 | - node.attr.size=cold 77 | - bootstrap.memory_lock=true 78 | - ES_JAVA_OPTS=-Xms512m -Xmx512m 79 | - discovery.seed_hosts=elasticsearch-hot,elasticsearch-warm 80 | - cluster.initial_master_nodes=elasticsearch-hot,elasticsearch-warm,elasticsearch-cold 81 | - xpack.monitoring.collection.enabled=true 82 | - path.repo=/usr/share/elasticsearch/backup 83 | ulimits: 84 | memlock: 85 | soft: -1 86 | hard: -1 87 | mem_limit: 1g 88 | volumes: 89 | - elasticsearch_data_cold:/usr/share/elasticsearch/data 90 | - elasticsearch_backup:/usr/share/elasticsearch/backup 91 | ports: 92 | - 9202:9200 93 | networks: 94 | - esnet 95 | 96 | kibana: 97 | container_name: kibana 98 | image: docker.elastic.co/kibana/kibana:$ELASTIC_VERSION 99 | ports: 100 | - 5601:5601 101 | volumes: 102 | - ./kibana.yml:/usr/share/kibana/config/kibana.yml:ro 103 | depends_on: 104 | - elasticsearch-hot 105 | - elasticsearch-warm 106 | - elasticsearch-cold 107 | networks: 108 | - esnet 109 | 110 | configure_stack: 111 | container_name: configure_stack 112 | image: docker.elastic.co/beats/metricbeat:${ELASTIC_VERSION} 113 | volumes: 114 | - ./setup/:/opt/setup/:ro 115 | command: /opt/setup/setup.sh 116 | networks: 117 | - esnet 118 | depends_on: 119 | - elasticsearch-hot 120 | 121 | metricbeat: 122 | container_name: metricbeat 123 | hostname: metricbeat 124 | user: root 125 | image: docker.elastic.co/beats/metricbeat:${ELASTIC_VERSION} 126 | volumes: 127 | - ./metricbeat/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro 128 | - ./metricbeat/modules.d/:/usr/share/metricbeat/modules.d/:ro 129 | - /proc:/hostfs/proc:ro 130 | - /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro 131 | - /var/run/docker.sock:/var/run/docker.sock 132 | - /:/hostfs:ro 133 | command: metricbeat -e -system.hostfs=/hostfs -strict.perms=false 134 | depends_on: 135 | - elasticsearch-hot 136 | - kibana 137 | networks: 138 | - esnet 139 | restart: on-failure 140 | 141 | volumes: 142 | elasticsearch_data_warm: 143 | driver: local 144 | elasticsearch_data_hot: 145 | driver: local 146 | elasticsearch_data_cold: 147 | driver: local 148 | elasticsearch_backup: 149 | driver: local 150 | 151 | networks: 152 | esnet: 153 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------