温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ELK 实验(六)elasticsearch集群搭建

发布时间:2020-05-23 20:51:17 来源:网络 阅读:3016 作者:pcdog 栏目:大数据

本次实验使用3台虚拟机

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

检查配置,过滤掉注释

cat elasticsearch.yml | grep -v "^#"

node 168 启动

./bin/elasticssearch

ELK 实验(六)elasticsearch集群搭建

集群状态yellow,因为其他2台还没起。。。

[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]] ...]).

配置文件复制到其他2个节点

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

ELK 实验(六)elasticsearch集群搭建

ELK 实验(六)elasticsearch集群搭建

然后在各自的node启动elasticssearch

node 002

ELK 实验(六)elasticsearch集群搭建

node 003

ELK 实验(六)elasticsearch集群搭建

在master node的目录/usr/elasticsearch-6.2.3/logs

ELK 实验(六)elasticsearch集群搭建

可以看到cluster日志

tail -f ES_Cluster_Pcdog.log

尼玛日志毫无更新,去其他2个节点看,2个node都有报错,难道是我克隆出来的机器的问题? 容我修个错误。

[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]; ]

原来是data里面有原来的数据,干掉

[pactera@ELK_002 data]$ pwd

/usr/elasticsearch-6.2.3/data

[pactera@ELK_002 data]$ rm -rf nodes/

3个节点都正常了

node 168 ,发现master 角色169

ELK 实验(六)elasticsearch集群搭建

node 169 ,状态黄变绿

ELK 实验(六)elasticsearch集群搭建

node 170 ,发现master 角色169

ELK 实验(六)elasticsearch集群搭建

稍后我需要研究下如何选举master过程,这个cluster 3个master 3个data,实际生产应该是2个master然后多个data的。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI