Created
August 11, 2017 13:55
-
-
Save ruanbekker/7d2102c49e58de879d56c4be2b5a2c64 to your computer and use it in GitHub Desktop.
Bootstrap Elasticsearch Master Node on Ubuntu 16.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt update && apt upgrade -y | |
apt install software-properties-common python-software-properties apt-transport-https -y | |
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list | |
add-apt-repository ppa:webupd8team/java -y | |
apt update | |
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections | |
apt install oracle-java8-installer -y | |
apt install nginx apache2-utils elasticsearch -y | |
cat > /etc/elasticsearch/elasticsearch.yml << EOF | |
cluster.name: ruan-es-cluster | |
node.name: \${HOSTNAME} | |
node.master: true | |
node.data: false | |
path.logs: /var/log/elasticsearch | |
bootstrap.memory_lock: true | |
network.host: 0.0.0.0 | |
discovery.zen.minimum_master_nodes: 2 | |
discovery.zen.ping_timeout: 10s | |
discovery.zen.fd.ping_retries: 3 | |
discovery.zen.fd.ping_interval: 3s | |
discovery.zen.fd.ping_timeout: 30s | |
discovery.zen.ping.unicast.hosts: ["es-master-1", "es-master-2", "es-master-3"] | |
EOF | |
cat > /etc/default/elasticsearch << EOF | |
ES_STARTUP_SLEEP_TIME=5 | |
MAX_OPEN_FILES=65536 | |
MAX_LOCKED_MEMORY=unlimited | |
EOF | |
sed -i 's/#LimitMEMLOCK=infinity/LimitMEMLOCK=infinity/'g /usr/lib/systemd/system/elasticsearch.service | |
cat > /etc/security/limits.conf << EOF | |
elasticsearch soft nofile 65536 | |
elasticsearch hard nofile 65536 | |
elasticsearch soft memlock unlimited | |
elasticsearch hard memlock unlimited | |
EOF | |
systemctl daemon-reload | |
systemctl enable elasticsearch | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment