Last active
October 19, 2015 21:35
-
-
Save jpparis-orange/44e464b8bb09246a4239 to your computer and use it in GitHub Desktop.
Elasticsearch tribe node setup
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
# !/bin/bash | |
ES_BASE=/.../elasticsearch-1.4.2 | |
ES_CMD=${ES_BASE}/bin/elasticsearch | |
# cleanup. Commented so that it doesn't harm your environment | |
# kill $(jps | grep Elas | awk '{print $1}') | |
# rm ${ES_BASE}/logs/* | |
# start two clusters | |
${ES_CMD} -d \ | |
-Des.cluster.name="C1" \ | |
-Des.node.name="N1" \ | |
-Des.http.port="9201" \ | |
-Des.transport.tcp.port="9301" \ | |
-Des.discovery.zen.ping.multicast.enabled="false" \ | |
-Des.discovery.zen.ping.unicast.hosts=localhost | |
${ES_CMD} -d \ | |
-Des.cluster.name="C2" \ | |
-Des.node.name="N2" \ | |
-Des.http.port="9202" \ | |
-Des.transport.tcp.port="9302" \ | |
-Des.discovery.zen.ping.multicast.enabled="false" \ | |
-Des.discovery.zen.ping.unicast.hosts=localhost | |
# -Des.cluster.name="T1" \ | |
# T1.log : [2015-02-05 09:11:47,621][WARN ][discovery ] [N3] waited for 30s and no initial state was set by the discovery | |
# -Des.cluster.name="elasticsearch" \ | |
# elasticsearch.log : [2015-02-05 09:44:41,425][WARN ][discovery ] [N3] waited for 30s and no initial state was set by the discovery | |
# -Des.transport.tcp.port="9300" \ | |
# elasticsearch.log : - BindTransportException[Failed to bind to [9300]] | |
# -Des.transport.tcp.port="9900" \ | |
# elasticsearch.log : - BindTransportException[Failed to bind to [9900]] | |
# start tribe node | |
TRIBE_PORT=9200 | |
${ES_CMD} -d \ | |
-Des.node.name="N3" \ | |
-Des.http.port="${TRIBE_PORT}" \ | |
--tribe.t1.cluster.name C1 \ | |
--tribe.t1.discovery.zen.ping.multicast.enabled false \ | |
--tribe.t1.discovery.zen.ping.unicast.hosts localhost:9301 \ | |
--tribe.t2.cluster.name C2 \ | |
--tribe.t2.discovery.zen.ping.multicast.enabled false \ | |
--tribe.t2.discovery.zen.ping.unicast.hosts localhost:9302 | |
# wait for startup | |
for p in ${TRIBE_PORT} 9201 9202 | |
do | |
while ! $(curl localhost:${TRIBE_PORT} >/dev/null 2>/dev/null) | |
do | |
sleep 1 | |
done | |
done | |
# check nodes: I expect to have 5 nodes up after a while: | |
# one tribe node, and 2 nodes in each tribed cluster. | |
for s in $(seq 10) | |
do | |
echo "----- $s" | |
curl -s localhost:${TRIBE_PORT}/_cat/nodes?v 2>/dev/null | |
sleep 1 | |
done | |
# sample of expected output from _cat/nodes: | |
#----- 10 | |
#host ip heap.percent ram.percent load node.role master name | |
#local 127.0.0.1 c x N3 | |
#local 127.0.0.1 3 71 1.33 d x N2 | |
#local 127.0.0.1 c x N3 | |
#local 127.0.0.1 c x N3 | |
#local 127.0.0.1 4 71 1.33 d x N1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment