forked from wazuh/wazuh-docker
Improve cluster configuration
This commit is contained in:
@@ -9,13 +9,15 @@ remove_single_node_conf(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_cluster_config(){
|
||||||
|
sed -i '/# cluster node/,/# end cluster config/d' $1
|
||||||
|
}
|
||||||
|
|
||||||
# If Elasticsearch cluster is enable, then set up the elasticsearch.yml
|
# If Elasticsearch cluster is enable, then set up the elasticsearch.yml
|
||||||
if [[ $ELASTIC_CLUSTER == "true" && $CLUSTER_NODE_MASTER != "" && $CLUSTER_NODE_DATA != "" && $CLUSTER_NODE_INGEST != "" && $CLUSTER_MASTER_NODE_NAME != "" ]]; then
|
if [[ $ELASTIC_CLUSTER == "true" && $CLUSTER_NODE_MASTER != "" && $CLUSTER_NODE_DATA != "" && $CLUSTER_NODE_INGEST != "" && $CLUSTER_MASTER_NODE_NAME != "" ]]; then
|
||||||
|
|
||||||
remove_single_node_conf $elastic_config_file
|
|
||||||
|
|
||||||
# Remove the old configuration
|
# Remove the old configuration
|
||||||
sed -i '/# cluster node/,/# end cluster config/d' $elastic_config_file
|
remove_single_node_conf $elastic_config_file
|
||||||
|
remove_cluster_config $elastic_config_file
|
||||||
|
|
||||||
if [[ $CLUSTER_NODE_MASTER == "true" ]]; then
|
if [[ $CLUSTER_NODE_MASTER == "true" ]]; then
|
||||||
# Add the master configuration
|
# Add the master configuration
|
||||||
@@ -31,8 +33,9 @@ cluster.initial_master_nodes:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
elif [[ $CLUSTER_NODE_NAME != "" ]];then
|
elif [[ $CLUSTER_NODE_NAME != "" ]];then
|
||||||
|
# Remove the old configuration
|
||||||
sed -i '/# cluster node/,/# end cluster config/d' $elastic_config_file
|
remove_single_node_conf $elastic_config_file
|
||||||
|
remove_cluster_config $elastic_config_file
|
||||||
|
|
||||||
cat > $elastic_config_file << EOF
|
cat > $elastic_config_file << EOF
|
||||||
# cluster node
|
# cluster node
|
||||||
@@ -47,8 +50,8 @@ EOF
|
|||||||
fi
|
fi
|
||||||
# If the cluster is disabled, then set a single-node configuration
|
# If the cluster is disabled, then set a single-node configuration
|
||||||
else
|
else
|
||||||
sed -i '/# cluster node/,/# end cluster config/d' $elastic_config_file
|
# Remove the old configuration
|
||||||
# If it's not already configured
|
|
||||||
remove_single_node_conf $elastic_config_file
|
remove_single_node_conf $elastic_config_file
|
||||||
|
remove_cluster_config $elastic_config_file
|
||||||
echo "discovery.type: single-node" >> $elastic_config_file
|
echo "discovery.type: single-node" >> $elastic_config_file
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user