Commit 4baad149 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added elasticsearch 5.6.8; configured systemd service

parent a3680c99
all: jdk13
jdk13:
jdk13: useradd elasticsearch-service
tar xf elasticsearch-7.6.0.tar.gz
dd if=/dev/zero of=swap bs=1048576 count=1024
......@@ -11,13 +11,22 @@ jdk13:
cd elasticsearch-7.6.0 && GRADLE_USER_HOME=$$(pwd)/gradle ./gradlew :distribution:archives:oss-no-jdk-linux-tar:assemble --no-daemon -Dtests.jvms=1
cd elasticsearch-7.6.0 && tar xf distribution/archives/oss-no-jdk-linux-tar/build/distributions/elasticsearch-oss-7.6.0-SNAPSHOT-no-jdk-linux-*.tar.gz
cd elasticsearch-7.6.0 && mv elasticsearch-7.6.0-SNAPSHOT /opt/elasticsearch
chown -R elasticsearch.elasticsearch /opt/elasticsearch
mv /opt/elasticsearch/config /etc/elasticsearch
install -d -m755 -o elasticsearch -g elasticsearch /var/lib/elasticsearch
install -d -m755 -o elasticsearch -g elasticsearch /var/log/elasticsearch
@echo "d /run/elasticsearch 755 elasticsearch elasticsearch -" > /usr/lib/tmpfiles.d/elasticsearch.conf
@echo "vm.max_map_count = 262144" >> /etc/sysctl.d/elasticsearch.conf
@echo "$$ELASTICSEARCH_SERVICE" > /lib/systemd/system/elasticsearch.service
systemctl enable elasticsearch.service
swapoff swap
rm -rf swap
rm -rf elasticsearch-7.6.0
jdk8:
jdk8: useradd elasticsearch-service
tar xf elasticsearch-6.1.4.tar.gz
dd if=/dev/zero of=swap bs=1048576 count=1024
......@@ -28,8 +37,140 @@ jdk8:
cd elasticsearch-6.1.4 && JAVA_HOME=/opt/jdk GRADLE_USER_HOME=$$(pwd)/gradle ./gradlew assemble --no-daemon
cd elasticsearch-6.1.4 && tar xf distribution/tar/build/distributions/elasticsearch-6.1.4-SNAPSHOT.tar.gz
cd elasticsearch-6.1.4 && mv elasticsearch-6.1.4-SNAPSHOT /opt/elasticsearch
chown -R elasticsearch.elasticsearch /opt/elasticsearch
mv /opt/elasticsearch/config /etc/elasticsearch
install -d -m755 -o elasticsearch -g elasticsearch /var/lib/elasticsearch
install -d -m755 -o elasticsearch -g elasticsearch /var/log/elasticsearch
@echo "d /run/elasticsearch 755 elasticsearch elasticsearch -" > /usr/lib/tmpfiles.d/elasticsearch.conf
@echo "vm.max_map_count = 262144" >> /etc/sysctl.d/elasticsearch.conf
@echo "$$ELASTICSEARCH_SERVICE" > /lib/systemd/system/elasticsearch.service
systemctl enable elasticsearch.service
swapoff swap
rm -rf swap
rm -rf elasticsearch-6.1.4
5-6-8: useradd elasticsearch-service
tar xf elasticsearch-5.6.8.tar.gz
dd if=/dev/zero of=swap bs=1048576 count=1024
chmod 600 swap
mkswap swap
swapon swap
cd elasticsearch-5.6.8 && JAVA_HOME=/opt/jdk GRADLE_USER_HOME=$$(pwd)/gradle ./gradlew assemble --no-daemon
cd elasticsearch-5.6.8 && tar xf distribution/tar/build/distributions/elasticsearch-5.6.8-SNAPSHOT.tar.gz
cd elasticsearch-5.6.8 && mv elasticsearch-5.6.8-SNAPSHOT /opt/elasticsearch
chown -R elasticsearch.elasticsearch /opt/elasticsearch
mv /opt/elasticsearch/config /etc/elasticsearch
install -d -m755 -o elasticsearch -g elasticsearch /etc/elasticsearch/scripts
install -d -m755 -o elasticsearch -g elasticsearch /var/lib/elasticsearch
install -d -m755 -o elasticsearch -g elasticsearch /var/log/elasticsearch
sed -e 's|^-Xms.*|-Xms128m|' -i /etc/elasticsearch/jvm.options
sed -e 's|^-Xmx.*|-Xms1g|' -i /etc/elasticsearch/jvm.options
@echo "d /run/elasticsearch 755 elasticsearch elasticsearch -" > /usr/lib/tmpfiles.d/elasticsearch.conf
@echo "vm.max_map_count = 262144" >> /etc/sysctl.d/elasticsearch.conf
@echo "$$ELASTICSEARCH_SERVICE" > /lib/systemd/system/elasticsearch.service
systemctl enable elasticsearch.service
swapoff swap
rm -rf swap
rm -rf elasticsearch-5.6.8
useradd:
rm /etc/passwd
mv -v /data/etc/passwd /etc/passwd
rm /etc/group
mv -v /data/etc/group /etc/group
rm /etc/shadow
mv -v /data/etc/shadow /etc/shadow
rm /etc/gshadow
mv -v /data/etc/gshadow /etc/gshadow
groupadd -g 105 elasticsearch
useradd -c "Elasticsearch daemon" -d /opt/elasticsearch -g elasticsearch -s /bin/false -u 105 elasticsearch
rm /etc/passwd-
rm /etc/group-
rm /etc/shadow-
rm /etc/gshadow-
mv -v /etc/passwd /data/etc/passwd
ln -sv /data/etc/passwd /etc/passwd
mv -v /etc/group /data/etc/group
ln -sv /data/etc/group /etc/group
mv -v /etc/shadow /data/etc/shadow
ln -sv /data/etc/shadow /etc/shadow
mv -v /etc/gshadow /data/etc/gshadow
ln -sv /data/etc/gshadow /etc/gshadow
elasticsearch-service:
define ELASTICSEARCH_SERVICE
[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Environment=ES_HOME=/opt/elasticsearch
Environment=CONF_DIR=/etc/elasticsearch
Environment=DATA_DIR=/var/lib/elasticsearch
Environment=LOG_DIR=/var/log/elasticsearch
Environment=PID_DIR=/run/elasticsearch
Environment=JAVA_HOME=/opt/jdk
WorkingDirectory=/opt/elasticsearch
User=elasticsearch
Group=elasticsearch
ExecStart=/opt/elasticsearch/bin/elasticsearch -p $${PID_DIR}/elasticsearch.pid \
--quiet \
-Edefault.path.logs=$${LOG_DIR} \
-Edefault.path.data=$${DATA_DIR} \
-Edefault.path.conf=$${CONF_DIR}
Restart=on-failure
# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Specifies the maximum number of processes
LimitNPROC=2048
# Specifies the maximum size of virtual memory
LimitAS=infinity
# Specifies the maximum file size
LimitFSIZE=infinity
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM
# Send the signal only to the JVM rather than its control group
KillMode=process
# Java process is never killed
SendSIGKILL=no
# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
endef
export ELASTICSEARCH_SERVICE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment