本次實(shí)驗(yàn)使用3臺(tái)虛擬機(jī)
成都創(chuàng)新互聯(lián)公司-專(zhuān)業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性?xún)r(jià)比雙清網(wǎng)站開(kāi)發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式雙清網(wǎng)站制作公司更省心,省錢(qián),快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋雙清地區(qū)。費(fèi)用合理售后完善,十多年實(shí)體公司更值得信賴(lài)。
192.168.209.168
192.168.209.169
192.168.209.170
cp /usr/elasticsearch-6.2.3/config/elasticsearch.yml /usr/elasticsearch-6.2.3/config/elasticsearch.yml.bak
vi /usr/elasticsearch-6.2.3/config/elasticsearch.yml
cluster.name: ES_Cluster_Pcdog
node.name: 192.168.209.168
path.data: /usr/elasticsearch-6.2.3/data
path.logs: /usr/elasticsearch-6.2.3/logs
network.host: 192.168.209.168
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.209.168","192.168.209.169","192.168.209.170"]
discovery.zen.minimum_master_nodes: 3
discovery.zen.fd.ping_timeout: 120s
discovery.zen.fd.ping_retries: 6
discovery.zen.fd.ping_interval: 30s
cluster.routing.allocation.cluster_concurrent_rebalance: 40
cluster.routing.allocation.node_concurrent_recoveries: 40
cluster.routing.allocation.node_initial_primaries_recoveries: 40
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
檢查配置,過(guò)濾掉注釋
cat elasticsearch.yml | grep -v "^#"
node 168 啟動(dòng)
./bin/elasticssearch
集群狀態(tài)yellow,因?yàn)槠渌?臺(tái)還沒(méi)起。。。
[2018-04-20T11:36:16,000][INFO ][o.e.c.r.a.AllocationService] [192.168.209.168] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[logstash-2018.04.18][1]] ...]).
配置文件復(fù)制到其他2個(gè)節(jié)點(diǎn)
scp elasticsearch.yml 192.168.209.169:/usr/elasticsearch-6.2.3/config
scp elasticsearch.yml 192.168.209.170:/usr/elasticsearch-6.2.3/config
然后在各自的node啟動(dòng)elasticssearch
node 002
node 003
在master node的目錄/usr/elasticsearch-6.2.3/logs
可以看到cluster日志
tail -f ES_Cluster_Pcdog.log
尼瑪日志毫無(wú)更新,去其他2個(gè)節(jié)點(diǎn)看,2個(gè)node都有報(bào)錯(cuò),難道是我克隆出來(lái)的機(jī)器的問(wèn)題? 容我修個(gè)錯(cuò)誤。
[2018-04-20T11:49:10,794][INFO ][o.e.d.z.ZenDiscovery ] [192.168.209.169] failed to send join request to master [{192.168.209.168}{-aU5102ETMW8isf85FWEHA}{V4flu0jLRfixBA0Yf9740w}{192.168.209.168}{192.168.209.168:9300}], reason [RemoteTransportException[[192.168.209.168][192.168.209.168:9300][internal:discovery/zen/join]]; nested: IllegalArgumentException[can't add node {192.168.209.169}{-aU5102ETMW8isf85FWEHA}{1IesX0gaSZWz2_O3eKDvfw}{192.168.209.169}{192.168.209.169:9300}, found existing node {192.168.209.168}{-aU5102ETMW8isf85FWEHA}{V4flu0jLRfixBA0Yf9740w}{192.168.209.168}{192.168.209.168:9300} with the same id but is a different node instance]; ]
原來(lái)是data里面有原來(lái)的數(shù)據(jù),干掉
[pactera@ELK_002 data]$ pwd
/usr/elasticsearch-6.2.3/data
[pactera@ELK_002 data]$ rm -rf nodes/
3個(gè)節(jié)點(diǎn)都正常了
node 168 ,發(fā)現(xiàn)master 角色169
node 169 ,狀態(tài)黃變綠
node 170 ,發(fā)現(xiàn)master 角色169
稍后我需要研究下如何選舉master過(guò)程,這個(gè)cluster 3個(gè)master 3個(gè)data,實(shí)際生產(chǎn)應(yīng)該是2個(gè)master然后多個(gè)data的。