sh Ubuntu 16.04上的Bootstrap Elasticsearch数据节点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Ubuntu 16.04上的Bootstrap Elasticsearch数据节点相关的知识,希望对你有一定的参考价值。

#!/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 elasticsearch -y

mkfs.xfs /dev/xvdb
mkdir /data
echo '/dev/xvdb /data xfs defaults 0 0' >> /etc/fstab
mount -a
chown -R elasticsearch:elasticsearch /data

cat > /etc/elasticsearch/elasticsearch.yml << EOF
cluster.name: ruan-es-cluster
node.name: \${HOSTNAME}
node.master: false
node.data: true
path.data: /data
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 127.0.0.1
transport.host: 0.0.0.0
http.port: 9201
transport.tcp.port: 9300
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
systemctl enable nginx
chown -R elasticsearch:elasticsearch /data
reboot

以上是关于sh Ubuntu 16.04上的Bootstrap Elasticsearch数据节点的主要内容,如果未能解决你的问题,请参考以下文章

sh ubuntu 16.04

sh 添加交换到Ubuntu 16.04

sh 安装Ubuntu 16.04 LAMP

sh [Ubuntu 16.04]设备信息

sh Opencv 3.3 Ubuntu 16.04

sh 重新启动网络Ubuntu 16.04 CLI