Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Fix master eligible data nodes
Browse files Browse the repository at this point in the history
Passing the DATA_NODE argument installs Elasticsearch as a data *only* node. When a data node is master eligible, no DATA_NODE argument should be passed; renamed to DATA_ONLY_NODE for clarity
  • Loading branch information
russcam committed Jul 11, 2016
1 parent 12719bc commit 9739066
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
9 changes: 7 additions & 2 deletions src/scripts/data-node-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ES_VERSION="2.0.0"
INSTALL_PLUGINS=0
CLUSTER_USES_DEDICATED_MASTERS=0
DATANODE_COUNT=0
DATA_ONLY_NODE=0

USER_ADMIN_PWD="changeME"
USER_READ_PWD="changeME"
Expand Down Expand Up @@ -130,7 +131,7 @@ while getopts :n:v:A:R:K:S:Z:p:U:I:c:e:f:m:t:xyzldh optname; do
log "client node argument will be ignored"
;;
z) #data node
log "data node argument will be ignored"
DATA_ONLY_NODE=1
;;
p) #namespace prefix for nodes
NAMESPACE_PREFIX="${OPTARG}"
Expand Down Expand Up @@ -168,11 +169,15 @@ while getopts :n:v:A:R:K:S:Z:p:U:I:c:e:f:m:t:xyzldh optname; do
esac
done

INSTALL_COMMAND='bash elasticsearch-ubuntu-install.sh -z -n "'"$CLUSTER_NAME"'" -v "'"$ES_VERSION"'" -A "'"$USER_ADMIN_PWD"'" -R "'"$USER_READ_PWD"'" -K "'"$USER_KIBANA4_PWD"'" -S "'"$USER_KIBANA4_SERVER_PWD"'" -Z '"$DATANODE_COUNT"' -p "'"$NAMESPACE_PREFIX"'"'
INSTALL_COMMAND='bash elasticsearch-ubuntu-install.sh -n "'"$CLUSTER_NAME"'" -v "'"$ES_VERSION"'" -A "'"$USER_ADMIN_PWD"'" -R "'"$USER_READ_PWD"'" -K "'"$USER_KIBANA4_PWD"'" -S "'"$USER_KIBANA4_SERVER_PWD"'" -Z '"$DATANODE_COUNT"' -p "'"$NAMESPACE_PREFIX"'"'
if [ $CLUSTER_USES_DEDICATED_MASTERS -eq 1 ]; then
INSTALL_COMMAND="$INSTALL_COMMAND -d "
fi

if [ $DATA_ONLY_NODE -eq 1 ]; then
INSTALL_COMMAND="$INSTALL_COMMAND -z "
fi

if [ $INSTALL_PLUGINS -eq 1 ]; then
INSTALL_COMMAND="$INSTALL_COMMAND -l "
fi
Expand Down
12 changes: 6 additions & 6 deletions src/scripts/elasticsearch-ubuntu-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ NAMESPACE_PREFIX=""
ES_VERSION="2.0.0"
INSTALL_PLUGINS=0
CLIENT_ONLY_NODE=0
DATA_NODE=0
DATA_ONLY_NODE=0
MASTER_ONLY_NODE=0

CLUSTER_USES_DEDICATED_MASTERS=0
Expand Down Expand Up @@ -146,7 +146,7 @@ while getopts :n:v:A:R:K:S:Z:p:xyzldh optname; do
CLIENT_ONLY_NODE=1
;;
z) #data node
DATA_NODE=1
DATA_ONLY_NODE=1
;;
l) #install plugins
INSTALL_PLUGINS=1
Expand Down Expand Up @@ -293,25 +293,25 @@ configure_elasticsearch_yaml()
echo "discovery.zen.ping.unicast.hosts: $UNICAST_HOSTS" >> /etc/elasticsearch/elasticsearch.yml

# Configure Elasticsearch node type
log "[configure_elasticsearch_yaml] Configure master/client/data node type flags master-$MASTER_ONLY_NODE data-$DATA_NODE"
log "[configure_elasticsearch_yaml] Configure master/client/data node type flags master-$MASTER_ONLY_NODE data-$DATA_ONLY_NODE"

if [ ${MASTER_ONLY_NODE} -ne 0 ]; then
log "[configure_elasticsearch_yaml] Configure node as master only"
echo "node.master: true" >> /etc/elasticsearch/elasticsearch.yml
echo "node.data: false" >> /etc/elasticsearch/elasticsearch.yml
# echo "marvel.agent.enabled: false" >> /etc/elasticsearch/elasticsearch.yml
elif [ ${DATA_NODE} -ne 0 ]; then
elif [ ${DATA_ONLY_NODE} -ne 0 ]; then
log "[configure_elasticsearch_yaml] Configure node as data only"
echo "node.master: false" >> /etc/elasticsearch/elasticsearch.yml
echo "node.data: true" >> /etc/elasticsearch/elasticsearch.yml
# echo "marvel.agent.enabled: false" >> /etc/elasticsearch/elasticsearch.yml
elif [ ${CLIENT_ONLY_NODE} -ne 0 ]; then
log "[configure_elasticsearch_yaml] Configure node as data only"
log "[configure_elasticsearch_yaml] Configure node as client only"
echo "node.master: false" >> /etc/elasticsearch/elasticsearch.yml
echo "node.data: false" >> /etc/elasticsearch/elasticsearch.yml
# echo "marvel.agent.enabled: false" >> /etc/elasticsearch/elasticsearch.yml
else
log "[configure_elasticsearch_yaml] Configure node for master and data"
log "[configure_elasticsearch_yaml] Configure node as master and data"
echo "node.master: true" >> /etc/elasticsearch/elasticsearch.yml
echo "node.data: true" >> /etc/elasticsearch/elasticsearch.yml
fi
Expand Down
1 change: 1 addition & 0 deletions src/scripts/kibana-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ help()
log()
{
echo \[$(date +%d%m%Y-%H:%M:%S)\] "$1"
echo \[$(date +%d%m%Y-%H:%M:%S)\] "$1" >> /var/log/arm-install.log
}

log "Begin execution of Kibana script extension on ${HOSTNAME}"
Expand Down

1 comment on commit 9739066

@Mpdreamz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.