1 |
|
2 |
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch |
3 |
|
4 |
cat > /etc/yum.repos.d/elasticsearch.repo << EOF |
5 |
[elasticsearch-5.x] |
6 |
name=Elasticsearch repository for 5.x packages |
7 |
baseurl=https://artifacts.elastic.co/packages/5.x/yum |
8 |
gpgcheck=1 |
9 |
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch |
10 |
enabled=1 |
11 |
autorefresh=1 |
12 |
type=rpm-md |
13 |
EOF |
14 |
|
15 |
yum install elasticsearch -y |
16 |
|
17 |
sed "s/\"80\"/\"9200\"/;s/WWW (HTTP)/Elasticsearch/;/.*/d" /usr/lib/firewalld/services/http.xml > /etc/firewalld/services/elasticsearch.xml |
18 |
firewall-cmd --permanent --zone=public --add-interface=eth0 |
19 |
firewall-cmd --permanent --add-service=elasticsearch --zone=public |
20 |
firewall-cmd --reload |
21 |
|
22 |
export PUBLIC_IP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') |
23 |
|
24 |
cat > /etc/elasticsearch/elasticsearch.yml << EOF |
25 |
cluster.name: my-search-cluster |
26 |
node.name: search01 |
27 |
network.host: $PUBLIC_IP |
28 |
EOF |
29 |
|
30 |
systemctl start elasticsearch |
31 |
systemctl enable elasticsearch |
32 |
|