-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-master.sh
58 lines (40 loc) · 1.77 KB
/
setup-master.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Installing Elasticsearch
wget --quiet https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.12.2-amd64.deb
sudo dpkg -i elasticsearch-8.12.2-amd64.deb
# Configure Elasticsearch
content=$(cat <<EOF
# ======================== Elasticsearch Configuration =========================
# DATE ${es_creation_date}
# ---------------------------------- Cluster -----------------------------------
cluster.name: ${es_cluster_name}
# ----------------------------------- Nodes ------------------------------------
node.name: ${es_data_node_name}
node.roles: [ master, data, data_cold, data_content, data_hot, data_warm, ingest, ml, remote_cluster_client, transform]
# ----------------------------------- Paths ------------------------------------
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
# ---------------------------------- Network -----------------------------------
network.host: 0.0.0.0
http.port: 9200
# --------------------------------- Discovery ----------------------------------
discovery.seed_hosts: ${es_seed_hosts}
# ---------------------------------- Security ----------------------------------
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
enabled: false
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/elastic-certificates.p12
truststore.path: certs/elastic-certificates.p12
cluster.initial_master_nodes: ${initial_master_nodes}
EOF
)
echo "${content}" > /etc/elasticsearch/elasticsearch.yml
sudo mv /elastic-certificates.p12 /etc/elasticsearch/certs/elastic-certificates.p12
# Start Elasticsearch
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo /bin/systemctl start elasticsearch.service