From 847f403bd38262f3c385d86ad804ecfc1ccfc420 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 28 Nov 2015 11:35:59 -0600 Subject: [PATCH] [es] Fixed #45 with corrected binding and re-worked example * also upgraded to 2.1.0 * added a MULTICAST env var for supporting networks --- .gitattributes | 17 +++++++++++++++++ elasticsearch/Dockerfile | 4 ++-- elasticsearch/README.md | 17 ++++++----------- elasticsearch/start | 4 ++++ 4 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..bdb0cabc --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index 02615a1f..bec58b55 100755 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -2,7 +2,7 @@ FROM itzg/ubuntu-openjdk-7 MAINTAINER itzg -ENV ES_VERSION 2.0.0 +ENV ES_VERSION 2.1.0 RUN wget -qO /tmp/es.tgz https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz && \ cd /usr/share && \ @@ -23,6 +23,6 @@ USER elasticsearch EXPOSE 9200 9300 -ENV OPTS=-Dnetwork.bind_host=_non_loopback_ +ENV OPTS=-Dnetwork.host=_non_loopback_ CMD ["/start"] diff --git a/elasticsearch/README.md b/elasticsearch/README.md index a256c5a1..fb09660c 100755 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -31,21 +31,16 @@ http://DOCKERHOST:9200/ Where `DOCKERHOST` would be the actual hostname of your host running Docker. -# Basic multi-node cluster +# Simple, multi-node cluster -Running a multi-node cluster (3-node in this example) is almost as easy: +To run a multi-node cluster (3-node in this example) on a single Docker machine use: - docker run -d -p 9200:9200 -p 9300:9300 itzg/elasticsearch - docker run -d -p 9201:9200 -p 9301:9300 itzg/elasticsearch - docker run -d -p 9202:9200 -p 9302:9300 itzg/elasticsearch + docker run -d --name es0 -p 9200:9200 es + docker run -d --name es1 --link es0 -e UNICAST_HOSTS=es0 es + docker run -d --name es2 --link es0 -e UNICAST_HOSTS=es0 es -where the only difference was the host port binding of `9200:`/`9300:`, -`9201:`/`9301:`, and `9202:`/`9302:`. By default, Elasticsearch uses -[Zen Discovery](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html), so the three nodes find each other and form a cluster. You -can confirm that by checking the cluster health for the presence of -three nodes (`number_of_nodes`): -http://DOCKERHOST:9200/_cluster/health?pretty +and then check the cluster health, such as http://192.168.99.100:9200/_cluster/health?pretty { "cluster_name" : "elasticsearch", diff --git a/elasticsearch/start b/elasticsearch/start index 5ae07f70..a614f091 100755 --- a/elasticsearch/start +++ b/elasticsearch/start @@ -32,6 +32,10 @@ if [ -n "$NODE_NAME" ]; then OPTS="$OPTS -Des.node.name=$NODE_NAME" fi +if [ -n "$MULTICAST" ]; then + OPTS="$OPTS -Des.discovery.zen.ping.multicast.enabled=$MULTICAST" +fi + if [ -n "$UNICAST_HOSTS" ]; then OPTS="$OPTS -Des.discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS" fi