狐狸情 发表于 2019-1-28 09:09:55

ELK 实验(六)elasticsearch集群搭建

  本次实验使用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
http://i2.运维网.com/images/blog/201804/20/73604091cd224b3835a7bf75a3918137.jpg
  集群状态yellow,因为其他2台还没起。。。
   Cluster health status changed from to (reason: ] ...]).
  配置文件复制到其他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
http://i2.运维网.com/images/blog/201804/20/16e002845a3d9669295939f5301ecbbe.jpg
http://i2.运维网.com/images/blog/201804/20/1488ff4569081a407f5f4f795ddffc96.jpg
  然后在各自的node启动elasticssearch
  node 002
http://i2.运维网.com/images/blog/201804/20/7352b61d0eeaad4913cf2a949dd562b4.jpg
  node 003
http://i2.运维网.com/images/blog/201804/20/bb82667c447eefc15177e685a616c1f9.jpg
  在master node的目录/usr/elasticsearch-6.2.3/logs
http://i2.运维网.com/images/blog/201804/20/b27491e2786a6935498e1f10f6eae7b3.jpg
  可以看到cluster日志
  tail -f ES_Cluster_Pcdog.log
  尼玛日志毫无更新,去其他2个节点看,2个node都有报错,难道是我克隆出来的机器的问题? 容我修个错误。
   failed to send join request to master [{192.168.209.168}{-aU5102ETMW8isf85FWEHA}{V4flu0jLRfixBA0Yf9740w}{192.168.209.168}{192.168.209.168:9300}], reason ]; nested: IllegalArgumentException; ]
  原来是data里面有原来的数据,干掉
  $ pwd
  /usr/elasticsearch-6.2.3/data
  $ rm -rf nodes/
  3个节点都正常了
  node 168 ,发现master 角色169
http://i2.运维网.com/images/blog/201804/20/780a32142fca2b98641789500654bed0.jpg
  node 169 ,状态黄变绿
http://i2.运维网.com/images/blog/201804/20/0d8486836df62a0d3051a22fa3b7826a.jpg
  node 170 ,发现master 角色169
http://i2.运维网.com/images/blog/201804/20/f9c04fb3abd1695e42ec6e89388b0ff1.jpg
  稍后我需要研究下如何选举master过程,这个cluster 3个master 3个data,实际生产应该是2个master然后多个data的。



页: [1]
查看完整版本: ELK 实验(六)elasticsearch集群搭建