Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 9c5bde3

Browse files
author
Chris Wiechmann
committed
Using only the first Elasticsearch-Cluster node when initializing the cluster
#150
1 parent f7d4282 commit 9c5bde3

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- Helm Default-Values for Kibana Memory-Limits changed from 300MB to 500MB (Request) and 300MB to 750MB (Limit)
1313
- Updated dependencies of a number of packages to fix security issues
1414

15+
### Fixed
16+
- Error initializing cluster when having multiple ELASTICSEARCH_HOSTS configured [#150](https://github.com/Axway-API-Management-Plus/apigateway-openlogging-elk/issues/150)
17+
1518
## [3.6.0] 2021-09-20
1619
### Added
1720
- Make sure Filebeat is not mixing up OpenTraffic with other Log-Files such as Audit-Log [#145](https://github.com/Axway-API-Management-Plus/apigateway-openlogging-elk/issues/145)

elasticsearch/scripts/elasticsearch-custom-entrypoint.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@ nodeNumber=`echo node.name | awk 'match(ENVIRON[$0], /([a-zA-Z]*)([0-9]{1,})/, v
1212
count=1
1313
params=""
1414
seedHosts=""
15-
initialMasterNodes=""
15+
initialMasterNode=""
1616
for host in ${ELASTICSEARCH_HOSTS//,/ }
1717
do
18-
# Use all nodes as initial master node, when initializing the cluster
18+
# Use only the first node as initial master node, when initializing the cluster
1919
# It is assumed, that node-names are sequentially counted elasticsearch1, elasticsearch2, ...
20-
if [ "${initCluster}" = "true" ]; then
21-
if [ "${initialMasterNodes}" == "" ]; then
22-
echo "Init Elasticsearch cluster using nodeBasename: ${nodeBasename} and count: ${count}"
23-
initialMasterNodes="-E cluster.initial_master_nodes=${nodeBasename}${count}"
24-
else
25-
echo "Init Elasticsearch cluster with given initialMasterNodes: ${initialMasterNodes}"
26-
initialMasterNodes="-E cluster.initial_master_nodes=${initialMasterNodes}"
27-
fi
20+
if [ "${initCluster}" = "true" -a "${initialMasterNode}" == "" ]; then
21+
echo "Init Elasticsearch cluster using nodeBasename: ${nodeBasename} and count: ${count}"
22+
initialMasterNode="-E cluster.initial_master_nodes=${nodeBasename}${count}"
2823
fi
2924
# Use all declared hosts as seed hosts if
3025
# Seeds hosts are not given externally and the standard transport ports are used
@@ -89,4 +84,4 @@ if [ "${ELASTICSEARCH_ANONYMOUS_ENABLED}" = "true" ]; then
8984
fi
9085

9186
# Finally call the original Docker-Entrypoint
92-
/usr/local/bin/docker-entrypoint.sh elasticsearch ${params} ${seedHosts} ${initialMasterNodes} ${anonymousUsername} ${anonymousRoles}
87+
/usr/local/bin/docker-entrypoint.sh elasticsearch ${params} ${seedHosts} ${initialMasterNode} ${anonymousUsername} ${anonymousRoles}

0 commit comments

Comments
 (0)