Last active
December 9, 2015 14:05
-
-
Save fquffio/07426890fc737df6231c to your computer and use it in GitHub Desktop.
Create an Elasticsearch cluster with one exposed node (with a Kopf panel installed) that acts as the "master" and a variable amount of "slave" (though they are eligible as masters, too) nodes.
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
### | |
# Create an ElasticSearch cluster | |
### | |
ES_NODES_COUNT=4 | |
HOSTS=es_master | |
for (( i=1; i<=$ES_NODES_COUNT; i++ )); do HOSTS=${HOSTS},es_node0$i; done | |
echo ${HOSTS} | |
# Create the first ES machine | |
docker run -d --name es_master \ | |
--net overlay \ | |
-v "es_master:/usr/share/elasticsearch/data" \ | |
-p "9200:9200" -p "9300:9300" \ | |
--env="constraint:node==swarm-master" \ | |
chialab/elasticsearch:manager \ | |
--node.name "Manager" \ | |
--discovery.zen.ping.multicast.enabled=false \ | |
--discovery.zen.ping.unicast.hosts=${HOSTS} | |
# Create the other nodes | |
for (( i=1; i<=$ES_NODES_COUNT; i++ )); do | |
docker run -d --name es_node0$i \ | |
--net overlay \ | |
-v "es_node0$i:/usr/share/elasticsearch/data" \ | |
chialab/elasticsearch \ | |
--node.name "Node 0$i" \ | |
--discovery.zen.ping.multicast.enabled=false \ | |
--discovery.zen.ping.unicast.hosts=${HOSTS} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment