LMS知識社群各系上網率圖資處首頁登入
02. Elasticsearch Cluster 6.X (Log量太大建議採用)
by 洪瑞展 2019-05-22 08:51:44, 回應(0), 人氣(443)
#事前準備(每台4 vcpu,8G ram,300G HD)
192.168.100.10 esMaster
192.168.100.11 esData01
192.168.100.12 esData02 

#以上每台皆如下安裝與設定
#=============================================================

#請先安裝Java

#設定/etc/hosts新增下列內容
192.168.100.10 esMaster
192.168.100.11 esData01
192.168.100.12 esData02

#設定elasticsearch.repo
vim /etc/yum.repos.d/elasticsearch.repo

#新增下列內容
[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/oss-6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

#安裝elasticsearch
yum install elasticsearch -y

#設定elasticsearch
vim /etc/elasticsearch/elasticsearch.yml

#修改以下內容
cluster.name: graylog
node.name: ${HOSTNAME}
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["esMaster", "esData01", "esData02"]
#discovery.zen.minimum_master_nodes計算方式:Node總數/2 + 1
#可參考最下方建議
discovery.zen.minimum_master_nodes: 3
action.auto_create_index: false

#啟用與設定開起啟動elasticsearch
chkconfig --add elasticsearch
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl restart elasticsearch.service

#開啟防火牆
firewall-cmd --add-port={9200/tcp,9300/tcp} --permanent 
firewall-cmd --reload 



#discovery.zen.minimum_master_nodes參考
Master nodes minimum_master_nodes Comments
1 1  
2 1 With 2 the other node going down would stop the cluster from working!
3 2  
4 3  
5 3  
6 4