ubuntu-2204-graylog/0015-configure-opensearch.sh
Eliezer Croitoru 79aea6bf40 1
2024-01-08 00:30:05 +02:00

35 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
CONFIG_FILE="/etc/opensearch/opensearch.yml"
grep 'discovery.type: single-node' "${CONFIG_FILE}" || \
echo "discovery.type: single-node" >> "${CONFIG_FILE}"
sed -i -e "s@^#cluster.name:.*@cluster.name: graylog@g" \
-e "s@^cluster.name:.*@cluster.name: graylog@g" \
-e "s@^#node.name:.*@node.name: ${HOSTNAME}@g" \
-e "s@^node.name:.*@node.name: ${HOSTNAME}@g" \
-e "s@^#path.data:.*@path.data: /var/lib/opensearch@g" \
-e "s@^path.data:.*@path.data: /var/lib/opensearch@g" \
-e "s@^#path.log:.*@path.log: /var/log/opensearch@g" \
-e "s@^path.log:.*@path.log: /var/log/opensearch@g" \
-e "s@^#discovery.type:.*@discovery.type: single-node@g" \
-e "s@^discovery.type:.*@discovery.type: single-node@g" \
-e "s@^#network.host:.*@network.host: 0.0.0.0@g" \
-e "s@^network.host:.*@network.host: 0.0.0.0@g" \
-e "s@^#action.auto_create_index:.*@action.auto_create_index: false@g" \
-e "s@^action.auto_create_index:.*@action.auto_create_index: false@g" \
-e "s@^#plugins.security.disabled:.*@plugins.security.disabled: true@g" \
-e "s@^plugins.security.disabled:.*@plugins.security.disabled: true@g" \
"${CONFIG_FILE}"
sed -i -e "s@^\-Xms1g@-Xms4g@g" \
-e "s@^\-Xmx1g@-Xmx4g@g" \
"/etc/opensearch/jvm.options"
echo 'vm.max_map_count=262144' > /etc/sysctl.conf.d/010-opensearch.conf
sysctl --system