elasticsearch 伪集群部署

1. 环境准备

IP 主机名 安装软件 操作系统
192.168.2.20 master es,jdk1.8 ubuntu18.04

我们部署ELK 5.X 本文介绍伪集群部署,也就是单个机器上跑多个es组成的集群

2. 伪集群启动

/opt/elasticsearch/bin/elasticsearch &
/opt/elasticsearch/bin/elasticsearch -Ehttp.port=8200 -Epath.data=node1 &
/opt/elasticsearch/bin/elasticsearch -Ehttp.port=7200 -Epath.data=node2 &
查看集群状态
curl master:9200/_cluster/stats|json
curl master:8200/_cat/nodes?v

检查
root@master:~# curl master:9200/_cluster/stats|json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1732  100  1732    0     0  15889      0 --:--:-- --:--:-- --:--:-- 19460
{
  "_nodes": {
    "total": 3,
    "successful": 3,
    "failed": 0
  },
  "cluster_name": "cmzes",
  "timestamp": 1570594668488,
  "status": "green",
  "indices": {
    "count": 0,
    "shards": {},
    "docs": {
      "count": 0,
      "deleted": 0
    },
    "store": {
      "size_in_bytes": 0,
      "throttle_time_in_millis": 0
    },
    "fielddata": {
      "memory_size_in_bytes": 0,
      "evictions": 0
    },
    "query_cache": {
      "memory_size_in_bytes": 0,
      "total_count": 0,
      "hit_count": 0,
      "miss_count": 0,
      "cache_size": 0,
      "cache_count": 0,
      "evictions": 0
    },
    "completion": {
      "size_in_bytes": 0
    },
    "segments": {
      "count": 0,
      "memory_in_bytes": 0,
      "terms_memory_in_bytes": 0,
      "stored_fields_memory_in_bytes": 0,
      "term_vectors_memory_in_bytes": 0,
      "norms_memory_in_bytes": 0,
      "points_memory_in_bytes": 0,
      "doc_values_memory_in_bytes": 0,
      "index_writer_memory_in_bytes": 0,
      "version_map_memory_in_bytes": 0,
      "fixed_bit_set_memory_in_bytes": 0,
      "max_unsafe_auto_id_timestamp": -9223372036854776000,
      "file_sizes": {}
    }
  },
  "nodes": {
    "count": {
      "total": 3,
      "data": 3,
      "coordinating_only": 0,
      "master": 3,
      "ingest": 3
    },
    "versions": [
      "5.6.16"
    ],
    "os": {
      "available_processors": 24,
      "allocated_processors": 24,
      "names": [
        {
          "name": "Linux",
          "count": 3
        }
      ],
      "mem": {
        "total_in_bytes": 24891125760,
        "free_in_bytes": 422547456,
        "used_in_bytes": 24468578304,
        "free_percent": 2,
        "used_percent": 98
      }
    },
    "process": {
      "cpu": {
        "percent": 0
      },
      "open_file_descriptors": {
        "min": 293,
        "max": 294,
        "avg": 293
      }
    },
    "jvm": {
      "max_uptime_in_millis": 619659,
      "versions": [
        {
          "version": "1.8.0_112",
          "vm_name": "Java HotSpot(TM) 64-Bit Server VM",
          "vm_version": "25.112-b15",
          "vm_vendor": "Oracle Corporation",
          "count": 3
        }
      ],
      "mem": {
        "heap_used_in_bytes": 1688978168,
        "heap_max_in_bytes": 6233260032
      },
      "threads": 151
    },
    "fs": {
      "total_in_bytes": 982900588544,
      "free_in_bytes": 970852659200,
      "available_in_bytes": 920852574208,
      "spins": "true"
    },
    "plugins": [],
    "network_types": {
      "transport_types": {
        "netty4": 3
      },
      "http_types": {
        "netty4": 3
      }
    }
  }
}
查看node节点
root@master:~# curl master:8200/_cat/nodes?v
ip           heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.2.20           29          99   0    0.18    0.56     0.47 mdi       -      master
192.168.2.20           25          99   0    0.18    0.56     0.47 mdi       -      master
192.168.2.20           29          99   0    0.18    0.56     0.47 mdi       *      master