Created
March 8, 2023 19:08
-
-
Save kid-cavaquinho/f6272c358037b49ff54b531524f8e257 to your computer and use it in GitHub Desktop.
opensearch cluster docker
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
| # Run `docker compose up` | |
| # If in Windows while running WSL open the powershell and run `wsl -d docker-desktop` then `sysctl -w vm.max_map_count=262144` to increase memory limits | |
| # Create an index: `curl -X PUT "https://localhost:9200/test00001?pretty"` | |
| # Add test data to the previously created index: `curl -X POST "https://localhost:9200/test00001/_bulk?pretty&refresh" -H "Content-Type: application/x-ndjson" --data-binary @"test-data.json" -u "admin:admin" --insecure` | |
| version: '3' | |
| services: | |
| opensearch-node1: | |
| image: opensearchproject/opensearch:latest | |
| container_name: opensearch-node1 | |
| environment: | |
| - cluster.name=opensearch-cluster | |
| - node.name=opensearch-node1 | |
| - discovery.seed_hosts=opensearch-node1,opensearch-node2 | |
| - cluster.initial_master_nodes=opensearch-node1,opensearch-node2 | |
| - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping | |
| - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM | |
| ulimits: | |
| memlock: | |
| soft: -1 | |
| hard: -1 | |
| nofile: | |
| soft: 65536 # maximum number of open files for the OpenSearch user, set to at least 65536 on modern systems | |
| hard: 65536 | |
| volumes: | |
| - opensearch-data1:/usr/share/opensearch/data | |
| ports: | |
| - 9200:9200 | |
| - 9600:9600 # required for Performance Analyzer | |
| networks: | |
| - opensearch-net | |
| opensearch-node2: | |
| image: opensearchproject/opensearch:latest | |
| container_name: opensearch-node2 | |
| environment: | |
| - cluster.name=opensearch-cluster | |
| - node.name=opensearch-node2 | |
| - discovery.seed_hosts=opensearch-node1,opensearch-node2 | |
| - cluster.initial_master_nodes=opensearch-node1,opensearch-node2 | |
| - bootstrap.memory_lock=true | |
| - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" | |
| ulimits: | |
| memlock: | |
| soft: -1 | |
| hard: -1 | |
| nofile: | |
| soft: 65536 | |
| hard: 65536 | |
| volumes: | |
| - opensearch-data2:/usr/share/opensearch/data | |
| networks: | |
| - opensearch-net | |
| opensearch-dashboards: | |
| image: opensearchproject/opensearch-dashboards:latest | |
| container_name: opensearch-dashboards | |
| ports: | |
| - 5601:5601 | |
| expose: | |
| - "5601" | |
| environment: | |
| OPENSEARCH_HOSTS: '["https://opensearch-node1:9200","https://opensearch-node2:9200"]' | |
| networks: | |
| - opensearch-net | |
| volumes: | |
| opensearch-data1: | |
| opensearch-data2: | |
| networks: | |
| opensearch-net: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment