Created
November 24, 2020 16:56
-
-
Save antonga23/65e2db8c00562fa736afa16829e11bbf to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
docker run --rm --ulimit nofile=65536:65536 --name esn01 -p 9200:9200 -v esdata01:/usr/share/elasticsearch/data --network elastic-network -e "node.name=esn01" -e "cluster.name=es-cluster" -e "cluster.initial_master_nodes=esn01" -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 -e ES_JAVA_OPTS="-Xms2g -Xmx2g" docker.elastic.co/elasticsearch/elasticsearch:7.3.0 | |
# Create the master node for our cluster | |
# NB we increase max file descriptors to 65536 using the nofile argument | |
# Expected Output should be similar to this | |
# {“type”: “server”, “timestamp”: “2019–08–18T13:40:18,575+0000”, “level”: “INFO”, “component”: “o.e.n.Node”, “cluster.name”: “docker-cluster”, “node.name”: “esn01”, “cluster.uuid”: “ilHqkY4UQuSRYnE5hFbhBg”, “node.id”: “KKnVMTDwQR6tinaGW_8kKg”, “message”: “started” } |
This file contains 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
#!/usr/bin/env bash | |
docker network create elastic-network # create a network for nodes to communicate across |
This file contains 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
#!/usr/bin/env bash | |
docker run --rm --ulimit nofile=65536:65536 --name esn02 -p 9202:9200 -v esdata02:/usr/share/elasticsearch/data --network elastic-network -e "node.name=esn02" -e "cluster.name=es-cluster" -e "discovery.seed_hosts=esn01" -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:7.3.0 | |
# second node in our elasticsearch cluster |
This file contains 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
#!/usr/bin/env bash | |
docker run --rm --ulimit nofile=65536:65536 --name esn03 -p 9203:9200 -v esdata03:/usr/share/elasticsearch/data --network elastic-network -e "node.name=esn03" -e "cluster.name=es-cluster" -e "discovery.seed_hosts=esn01,esn02" -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 -e ES_JAVA_OPTS="-Xms1g -Xmx1g" docker.elastic.co/elasticsearch/elasticsearch:7.3.0 | |
# Third node in our elasticsearch cluster |
This file contains 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
#!/usr/bin/env bash | |
curl localhost:9200 | |
# Expected output | |
# { | |
# "name" : "esn01", | |
# "cluster_name" : "es-cluster", | |
# "cluster_uuid" : "ilHqkY4UQuSRYnE5hFbhBg", | |
# "version" : { | |
# "number" : "7.3.0", | |
# "build_flavor" : "default", | |
# "build_type" : "docker", | |
# "build_hash" : "de777fa", | |
# "build_date" : "2019–07–24T18:30:11.767338Z", | |
# "build_snapshot" : false, | |
# "lucene_version" : "8.1.0", | |
# "minimum_wire_compatibility_version" : "6.8.0", | |
# "minimum_index_compatibility_version" : "6.0.0-beta1" | |
# }, | |
# "tagline" : "You Know, for Search" | |
# } | |
curl localhost:9202/_cluster/health?pretty | |
# Expected output | |
# { | |
# "cluster_name" : "es-cluster", | |
# "status" : "green", | |
# "timed_out" : false, | |
# "number_of_nodes" : 3, | |
# "number_of_data_nodes" : 3, | |
# "active_primary_shards" : 0, | |
# "active_shards" : 0, | |
# "relocating_shards" : 0, | |
# "initializing_shards" : 0, | |
# "unassigned_shards" : 0, | |
# "delayed_unassigned_shards" : 0, | |
# "number_of_pending_tasks" : 0, | |
# "number_of_in_flight_fetch" : 0, | |
# "task_max_waiting_in_queue_millis" : 0, | |
# "active_shards_percent_as_number" : 100.0 | |
# } | |
curl localhost:9203/_cat/nodes?v | |
# Expected output | |
# ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name | |
# {ipaddress} 26 56 3 0.01 0.16 0.17 dim * esn01 | |
# {ipaddress} 13 56 1 0.01 0.16 0.17 dim — esn03 | |
# {ipaddress} 20 56 2 0.01 0.16 0.17 dim — esn02 |
This file contains 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
#!/usr/bin/env bash | |
docker run --rm --link esn01:elasticsearch --name kibana --network elastic-network -p 5601:5601 docker.elastic.co/kibana/kibana:7.3.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment